Skip to content

Commit 4129fbb

Browse files
committed
ARXIVNG-1519 tuning search API for production
1 parent 86f94ac commit 4129fbb

File tree

5 files changed

+78
-83
lines changed

5 files changed

+78
-83
lines changed

Dockerfile-api

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Defines the runtime for the arXiv search API, which provides a metadata
44
# query API backed by Elasticsearch.
55

6-
FROM arxiv/base:0.12.1
6+
FROM arxiv/base:0.14.3
77

88
WORKDIR /opt/arxiv
99

@@ -22,11 +22,7 @@ ENV PATH "/opt/arxiv:${PATH}"
2222
ADD schema /opt/arxiv/schema
2323
ADD mappings /opt/arxiv/mappings
2424
ADD search /opt/arxiv/search
25-
ADD wsgi-api.py /opt/arxiv/wsgi.py
26-
RUN pip install uwsgi
27-
28-
ADD bin/start_search.sh /opt/arxiv/
29-
RUN chmod +x /opt/arxiv/start_search.sh
25+
ADD wsgi-api.py config/uwsgi-api.ini /opt/arxiv/
3026

3127
ENV LC_ALL en_US.utf8
3228
ENV LANG en_US.utf8
@@ -44,16 +40,5 @@ ENV METADATA_ENDPOINT https://arxiv.org/docmeta_bulk/
4440

4541
EXPOSE 8000
4642

47-
#CMD /bin/bash
48-
ENTRYPOINT ["/opt/arxiv/start_search.sh"]
49-
CMD ["--http-socket", ":8000", \
50-
"-M", \
51-
"-t 3000", \
52-
"--manage-script-name", \
53-
"--processes", "8", \
54-
"--threads", "1", \
55-
"--async", "100", \
56-
"--ugreen", \
57-
"--buffer-size", "65535", \
58-
"--mount", "/metadata=wsgi.py", \
59-
"--logformat", "%(addr) %(addr) - %(user_id)|%(session_id) [%(rtime)] [%(uagent)] \"%(method) %(uri) %(proto)\" %(status) %(size) %(micros) %(ttfb)"]
43+
ENTRYPOINT ["pipenv", "run"]
44+
CMD ["uwsgi", "--ini", "/opt/arxiv/uwsgi-api.ini"]

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
arxiv-auth = "==0.2.3"
7+
arxiv-auth = "==0.2.7"
88
arxiv-base = "==0.12.1"
99
boto = "==2.48.0"
1010
"boto3" = "==1.6.6"

Pipfile.lock

Lines changed: 58 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/uwsgi-api.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[uwsgi]
2+
http-socket = :8000
3+
chdir = /opt/arxiv/
4+
wsgi-file = wsgi-api.py
5+
callable = application
6+
master = true
7+
harakiri = 3000
8+
manage-script-name = true
9+
processes = 1
10+
queue = 0
11+
threads = 1
12+
single-interpreter = true
13+
mount = /=wsgi-api.py
14+
logformat = "%(addr) %(addr) - %(user_id)|%(session_id) [%(rtime)] [%(uagent)] \"%(method) %(uri) %(proto)\" %(status) %(size) %(micros) %(ttfb)"

search/routes/api/serialize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Serializers for API responses."""
22

33
from typing import Union, Optional
4-
from lxml import etree
4+
from xml.etree import ElementTree as etree
55
from flask import jsonify, url_for
66

77
from arxiv import status

0 commit comments

Comments
 (0)