adsabs / biblib-service

ADS library service
https://ui.adsabs.harvard.edu
MIT License
4 stars 8 forks source link

Timeout on library import #105

Closed spacemansteve closed 8 years ago

spacemansteve commented 8 years ago

A user receives "There was a problem and libraries were not imported.” This appears to be a timeout issue. The biblib application log file shows normal processing of until the gunicorn worker is cut off after 30 seconds. The user has 268 libraries

Sample from the log file: ==> biblib-service.production.access.log <== INFO 90 [08/31/2016 20:05:47]: Converted uuid: 0f509408-ed7d-43e2-9eda-1538dd6d9660 to slug: D1CUCO19Q-Ke2hU43W2WYA INFO 90 [08/31/2016 20:05:48]: Converted uuid: 657e479b-c2eb-4ad5-a4cd-5b18811a97c4 to slug: ZX5Hm8LrStWkzVsYgRqXxA INFO 90 [08/31/2016 20:05:48]: Converted uuid: 358e3676-1bc7-49a5-9741-1ede009c4439 to slug: NY42dhvHSaWXQR7eAJxEOQ INFO 90 [08/31/2016 20:05:49]: Converted uuid: 00359148-1134-428b-8355-49417df5beb2 to slug: ADWRSBE0QouDVUlBffW-sg INFO 90 [08/31/2016 20:05:49]: Converted uuid: b5d0cd3e-3676-4e41-b267-fda119b0cd9e to slug: tdDNPjZ2TkGyZ_2hGbDNng INFO 90 [08/31/2016 20:05:49]: Converted uuid: 03036352-1535-4674-9229-dc469285365d to slug: AwNjUhU1RnSSKdxGkoU2XQ INFO 90 [08/31/2016 20:05:50]: Converted uuid: 798545cb-6f40-45e7-a410-2fb4fb53816a to slug: eYVFy29AReekEC-0-1OBag INFO 90 [08/31/2016 20:05:50]: Converted uuid: 62d6ab7f-0699-4838-9141-2e862477a806 to slug: YtarfwaZSDiRQS6GJHeoBg INFO 90 [08/31/2016 20:05:50]: Creating library from scratch: {u'documents': [u'2010IAUS..267...17E', u'2009astro2010S..73F', u'2009MNRAS.398...53B', u'2008MNRAS.391..481S', u'\ 2008ApJS..175..356H', u'2006ApJ...643...14S'], u'description': u'', u'name': u'Quasars: Feedback and Galaxy Formation and Evoloution'} INFO 90 [08/31/2016 20:05:50]: Converted uuid: 0c708e06-6f0f-40a8-87e5-704da8adc3f3 to slug: DHCOBm8PQKiH5XBNqK3D8w INFO 90 [08/31/2016 20:05:51]: Converted uuid: 33fa7965-5efb-4dc5-a139-ecb6c2feae48 to slug: M_p5ZV77TcWhOey2wv6uSA

==> biblib-service.production.error.log <== [2016-08-31 20:05:51 +0000] [21] [CRITICAL] WORKER TIMEOUT (pid:90) [2016-08-31 20:05:51 +0000] [90] [INFO] Worker exiting (pid: 90) [2016-08-31 20:05:51 +0000] [94] [INFO] Booting worker with pid: 94

spacemansteve commented 8 years ago

One solution is to improve the performance of the library import. Note this would only increase the maximum number of libraries we can import. Beyond some number, we would still have a problem.

There is likely a chance to optimize the code at a quick review suggests the problem could be in https://github.com/adsabs/biblib-service/blob/master/biblib/views/classic_view.py#L27. As the comments highlight, the code makes several slow database queries for every library.

spacemansteve commented 8 years ago

Alberto tested on staging and production using a large set of libraries.