0

I usually use AWS Elastic Beanstalk, Heroku, and Microsoft Asure for hosting my Django projects. Also I usually use MySQL. However, I have difficulty identifying efficient number of threads and processes for mod_wsgi setting. Thank you in advance for your information.

1man
  • 5,216
  • 7
  • 42
  • 56

1 Answers1

1

If you are using the machine for the application server only, usually a good approach to start is using the double of processor cores in the machine, and increase gradually watching the CPU and RAM usage, until you find a optimal number.

If there is more services in the same machine (memcached, or even your database), start with a fewer processes, usually the number of cores + 1.

I think the best approach is to watch the resource consumption and increase the number of processes/threads gradually... Many processes = high CPU wait times. Few processes = idle resources (requests will queue up and wait)

Vitor Freitas
  • 3,550
  • 1
  • 24
  • 35
  • Thanks Vitor Freitas, do you know any resource that specifically explains how to set them in AWS Elastic Beanstalk, Heroku, and Microsoft Asure, ...? – 1man May 22 '16 at 18:10
  • 2
    The approach of using double number of processor cores is not appropriate where processes are multithreaded. What dictates how you balance processes vs threads is dependent on the specifics of the application and whether it is CPU bound vs I/O bound. That is not necessarily easy to work out and needs monitoring to be in place. The ancient mod_wsgi version that AWS uses doesn't have the monitoring built in which is needed to do it. In short there is no simple answer. – Graham Dumpleton May 23 '16 at 01:14
  • @Graham Simpleton, you have always fascinated me by how fast you answer questions. Please tell me if there's a better cloud service or if there is any document that teaches, step by step, how to develop a scalable website using mod_wsgi. – 1man May 24 '16 at 19:27
  • 1
    It isn't an answer, but you can see details about some of my latest research I was doing to work out best practices by watching https://www.youtube.com/watch?v=SGleKfigMsk – Graham Dumpleton May 25 '16 at 00:58