> On 15 May 2018, at 7:47 am, Leonardo Mata <barr...@gmail.com> 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.

> 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.

> 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?

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.

> 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?

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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to