Commit Graph

37 Commits

Author SHA1 Message Date
Athanasios Voutsadakis
850dd2505b Set db connection pool size to 1 for all workers
The workers are working sequentially so they don't need more than one
connection per thread.

This has been tested with the sender worker and it works fine even
under significant load, so this commit will make it the default for the
other workers as well.
2018-03-16 11:31:56 +00:00
Athanasios Voutsadakis
7268acdd38 Reduce parallel worker processes to 3
This was overly optimistic that 2G would be enough to handle 4 worker
processes as they are already exhausting the 2G limit.

Depending on performance we may need to tweak the memory instead/too.
2018-03-12 16:25:19 +00:00
Athanasios Voutsadakis
59de1ce24d Merge branch 'master' into support-celery-multi 2018-03-09 16:58:37 +00:00
Athanasios Voutsadakis
2b6efd09b4 Set pool size to 1 for sender worker 2018-03-09 16:57:12 +00:00
Leo Hemsted
22f86aa1b5 Revert service callback worker eventlets
We have seen problems with the service callback workers due to the db
connection pool being exhausted. When the worker picks up the task, it
makes a db query to get the notification, a query to get the callback
url, and then closes the session before it makes the 3rd party request.

However, even closing the session before the (potentially lengthy)
web request wasn't enough - we've seen significant amounts of
`sqlalchemy.exc.TimeoutError`s.

This reverts commit 2dfbd93c7e
2018-03-08 13:35:53 +00:00
Athanasios Voutsadakis
cf439575e5 Make the sender-worker use 4 celery workers and 2G of RAM 2018-02-27 17:38:16 +00:00
Alexey Bezhan
2dfbd93c7e Switch service callback workers to use eventlet pool implementation
Service callbacks are I/O bound and can take a long time if the
callback URL takes a long time to respond. This is a perfect use
case for an eventlet worker pool since it allows spawning multiple
green threads (1000 in the proposed configuration) to execute HTTP
requests concurrently without a significant increase in CPU load
or memory usage needed for adding additional worker processes.
2018-02-13 16:44:30 +00:00
Rebecca Law
780666163e Fix copy/paste error 2018-02-09 13:33:34 +00:00
Rebecca Law
f7ab04a8f8 When there are high volumes of emails being processed the SES callback task will trigger the service-callback task.
This PR creates a new worker to deal with the service-callback so that one event doesn't block the other.
2018-02-09 09:39:14 +00:00
Richard Chapman
d2693b6499 Tasks that are put on the notify-internal-tasks queue are notifications
sent by the notify service, including 2FA and email auth messages.
These should never be delayed by other messages in the queue.

Created a separate delivery app to consume the notify-internal-tasks
queue and only that queue.
2018-01-24 17:12:26 +00:00
Alexey Bezhan
5298f28f80 Add utils DeskproClient and configuration variables
Deskpro client is used to create tickets from celery alerting tasks
(eg alerts for missing ack or response files from DVLA).
2018-01-17 15:04:17 +00:00
Alexey Bezhan
ff8373600d Replace manifest services with lists of env variables
Removes bindings to user provided services for new application
deployments and sets the expected environment variables to `null`.

Listing variables in the manifest allows us to only inject secrets
used by the app. `null` is not a valid value for a variable in a
CloudFoundry manifest, so if any of the keys don't have a match in
the credentials file `cf push` will return an error and stop the
deployment.
2018-01-09 10:45:03 +00:00
Ken Tsang
b70bf1b541 Add letter tasks to manifest and queue name to config test 2017-12-19 13:23:55 +00:00
Leo Hemsted
5d3a3ab042 Can't have spaces between queue names 2017-12-14 13:26:38 +00:00
venusbb
2e7b3cf5e5 Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-callback-seperate-queue 2017-12-14 10:29:31 +00:00
Ken Tsang
fdf97fd8b5 Add create-letters-pdf-tasks to notify-delivery-worker 2017-12-13 11:34:05 +00:00
venusbb
11152ab117 Add new queue for callbacks 2017-12-13 10:57:08 +00:00
Ken Tsang
ebfd78f3cf Add template preview host url and key to cf config 2017-12-12 14:53:38 +00:00
Athanasios Voutsadakis
131495125e Add worker-receipts app 2017-10-27 12:05:15 +01:00
Leo Hemsted
e85b621cbc make perf platform client handle more stuff sensibly
specifically, all of the performance platform specific data layout now
happens in performance_platform_client.py - stuff like setting the
_timestamp, period etc, and the perf platform-specific nomenclature is
all handled there.
2017-08-24 17:10:42 +01:00
Leo Hemsted
3cb3cf438e remove SEND_COMBINED 2017-07-31 13:29:30 +01:00
Leo Hemsted
b5dc7642aa remove aws_run_celery file
it's no longer relevant since the switch to PaaS
2017-07-31 11:12:43 +01:00
Leo Hemsted
4d33040653 add separate send-sms and send-email queues
we're reading from those two queues as well as teh existing send queue,
however for now we don't send anything to them
2017-07-20 16:19:38 +01:00
minglis
501506f849 Merge pull request #996 from alphagov/stop-reading-from-old-queues
Removed references to old queus
2017-06-01 09:43:12 +01:00
Martyn Inglis
8e3b20e51d Gone back to 1G as fails if less 2017-05-31 16:46:56 +01:00
Martyn Inglis
25c8f71f2c Reduced memory footprint of the API apps.
Staging and prod now default to 768M of RAM, down from a 1G saves 512M per instance type
Preview down to 256M per app
2017-05-31 11:47:52 +01:00
Martyn Inglis
d74675b6d8 Removed references to old queus 2017-05-30 11:24:26 +01:00
Martyn Inglis
753d58f138 Adds new queues to the PaaS workers 2017-05-25 11:15:28 +01:00
Martyn Inglis
07b527bb1b All queues now managed in the same way:
- TEST and DEV builds set up their own queue lists for reading
- PROD/STAGE/PREVIEW use the separate worker process with the -Q flag

This enables us to rename queues in due course
2017-05-24 15:47:20 +01:00
Martyn Inglis
ea794705ab Removed whitespace from queue list 2017-05-18 10:24:03 +01:00
Martyn Inglis
e382d699a6 using the periodic worker to process the stats tasks. May need it's own worker in due course, but right now piggybacking. 2017-05-11 15:24:10 +01:00
Martyn Inglis
43bf973b1d A few changes to the celery workers
1) Beat worker now a single instance with 128M memory
2) New worker for periodic tasks. Single worker, 2G ram
3) new worker for priority queues. Standard instance and memory settings.
2017-04-04 13:43:28 +01:00
Martyn Inglis
787d0da7db Broke the periodic queue out from the standard worker.
- now has own worker with worker count of 2
- this is too ensure that any issues with scheduled jobs do not affect core applications
2017-04-04 11:23:54 +01:00
bandesz
b0d5def289 Increase memory for PaaS 2017-03-06 14:48:27 +00:00
bandesz
e8bf03c7e1 Get Redis config from PaaS 2017-03-03 11:35:51 +00:00
bandesz
652f76eaf6 Increase default memory to 512M for delivery PaaS workers 2017-02-28 18:54:57 +00:00
bandesz
72dc93c6db Add awslogs logging for PaaS 2017-02-16 17:38:30 +00:00