Hello Graham, thank you very much for the tips. I salute you for all your work and it is good to see your talks.
2018-05-15 15:12 GMT-03:00 Graham Dumpleton <[email protected]>: > > > > On 15 May 2018, at 7:47 am, Leonardo Mata <[email protected]> wrote: > > > > Hello there, I'm currently facing an issue on tuning my application o > Amazon AWS EC2 instance. > > > > My currently configuration is a C5.xlarge instance with python 2.7 > running on default amazon imaga. It uses apache httpd24-2.4.33-2.78 and > mod24_wsgi-python27-3.5-1.25.amzn1.x86_64. This instance has 8GB Ram and > 4 vCPUs. > > The mod_wsgi 3.5 version you are using is ancient and strongly recommend > you don't use it. Amazon doesn't provide support for mod_wsgi, and that > version is way older than anything I would help with either. > Makes sense, I will test it and see how it behaves > > > My application is a Flask with sqlalchemy to connect into a mysql db. > > > > I'm running a load-test with my own application with the most common > routes weighted by usage. So it is most like a real usage of this > application. > > But are you testing it with realistic traffic volumes or are you hammering > it with as much traffic as you can. Doing the latter will usually just > overload things regardless of the configuration used. > I was testing increasing the volume to find the number of req/s where my application starts to degrade. After this, I was testing with a constant req/s using this weighted pattern. > > > The configuration for wsgi has 10 processes and 40 threads, but no > matter how I change the configuration, the maximum req/s I can reach with a > decent response time is around 80req/s. More than that causes cpu burn at > 100%. > > How many requests per second are you expecting to handle and what average > response time? > I'm using apdex as my measure ( https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/apdex-measuring-user-satisfaction) white T as 120ms. My idea is to find the maximum requests per second where the apdex keeps on 0.9. 80req/s is the rate for my application, but I think there is space for improving this maximum throughput. > > Using 40 threads per process is usually a very bad idea with Python unless > you have an application which is excessively I/O bound where it is waiting > all the time on other things and isn't actually doing any work. > > Another issue is whether you are using embedded mode or daemon mode. Using > embedded mode would be a bad idea as Apache would then manage the processes > and can restart processes at arbitrary times which is really bad for > Python. You should use daemon mode instead. Then need to know the separate > details of the Apache MPM being used and how you configure the MPM. Also > then need to know full configuration used for daemon mode if are using that. > I will check this configuration, I'm using the Amazon's default for it. > > Do you think it is possible to get better usage of CPU changing the > number of process and threads or am I into a bottleneck of performance > because of this cpu intensive behavior of my application? > > Very hard to recommend anything without having performance metrics for > your application. The bottleneck could be in your database. Are you using > New Relic or Datadog application performance monitoring? > I'm using New Relic and Datadog, and CPU is the bottleneck for this configuration. I will check how to upgrade mod_wsgi so I can verify if it can help improving and let you know. > > Graham > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. > Best regards. -- Leonardo Luiz Padovani da Mata [email protected] "May the force be with you, always" "Nerd Pride... eu tenho. Voce tem?" -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
