Forums

Single worker for my persistent Flask app

Hi,

I've been having similar issues to what was described in this thread. My Flask app requires persistence across multiple AJAX transactions, and to get it working consistently while using multiple workers, I would have to move all of my data structures to a database or something which would be a lot of work for what is supposed to be a fairly simple web app which probably won't be seeing a lot of traffic anyway.

Could a PA staff member please limit the number of workers to my (only) web app to 1?

As a consequence of this, am I right in thinking that

  • If the app is busy serving person A's request, and person B makes a request at the same time, person B will just have to wait for A's request to finish before his request is handled?
  • I won't have to worry about any sort of concurrency issues because there would be a single worker running on a single thread?

Thanks!

Ok. I have reduced the workers for your web app and both of your points are correct.

Thank you for answering my questions.

I seem to still be having the same issues as before though. I looked in my server log, and it seems like my app is still using 2 workers:

2020-05-30 17:45:25 spawned uWSGI worker 1 (pid: 3, cores: 1)
2020-05-30 17:45:25 spawned 2 offload threads for uWSGI worker 1
2020-05-30 17:45:25 spawned uWSGI worker 2 (pid: 6, cores: 1)
2020-05-30 17:45:25 metrics collector thread started
2020-05-30 17:45:25 spawned 2 offload threads for uWSGI worker 2

I have reloaded the app. Any ideas?

Sorry. I forgot that a reload would undo that. I have modified you account so that a reload will not reset it any more. It will need a reload, though to enable it.

Everything's working now, thank you!

Excellent, thanks for confirming!