Marco,

First try to understand where the slowness is: a loop of yours, dal
building a resultset, postgresql.  Since the load comes from uwsgi seems a
problem on python/web2py side.  Use the profiler.

1. check you are using processes with uwsgi not threads in a number not
above twice the number of available cores.
2. reduce the load on python by loading a *limited* amount of records using
limitby i.e. page always resultsets.
3. reduce the load on postgresql by using limitby *and*
*orderby_on_limitby=False*
4. avoid load peaks as much as you can on EC2 else the CPU is throttled by
the supervisor leaving little or no CPU power available.

update web2py to latest trunk and do experiments.  Check if you can apply
the following optimization in your queries:

row = db(db.table.field==<value>).select().first() <- slow and memory
hungry!
row = db(db.table.field==<value>).select(limitby=(0,1),
orderby_on_limitby=False).first() <-fast and light on both python and pg
better yet since the dal does the same as above but less error prone:
row = db.table(field=<value>) <- good to read an fast!



2013/6/21 b00m_chef <[email protected]>

> Hi Marco,
>
> Did you ever resolve this? Did you ever improve the performance of your
> server?
>
> Any insights you could share?
>
> Thanks,
>
>
>
> On Thursday, 11 April 2013 08:02:14 UTC-7, Marco Tulio wrote:
>>
>>
>>
>>
>> 2013/4/11 LightDot <[email protected]>
>>
>> Are you using db connection pooling and do you cache your queries? That
>>> could help.
>>>
>>>
>>
>> Connection pooling was web2py default (0), wich means not being used.
>> What would be a good value ?
>>
>> About caching queries, no, wasn't doing that either.
>>
>> I'll try to check if this helps.
>>
>> Also, I see that this is affecting mostly one of my apps, not all of
>> them, and specially the oldest one, so, maybe there's something that I
>> could review on the code too, I'm going to check that.
>>
>> Anyway, thanks for the hints.
>>
>> Cheers,
>> Marco Tulio
>>
>>
>>
>>
>>
>>
>>
>>>
>>> On Thursday, April 11, 2013 2:45:41 PM UTC+2, Marco Tulio wrote:
>>>
>>>> about 50 to 90% ...
>>>> but I see that this is not a problem because of how fast the server
>>>> usually answers, this seems to be a problem when the page takes more time
>>>> to load a single page.
>>>> and it takes around 6 secs to load a page that checks the database.
>>>> If I open 5  pages at the same time, it's possible that I get "504
>>>> Gateway Time-out" on at least 1.
>>>>
>>>> pages that do not consult a database are imediatly served.
>>>>
>>>> The pages that are giving me more problem consult a database and have 1
>>>> chart (javascript) (similar to google charts).
>>>>
>>>> I'll do a few more tests changing a few things on those pages... maybe
>>>> there's something wrong with javascript or something else that's taking too
>>>> much time to load...
>>>>
>>>>
>>>>
>>>>
>>>> 2013/4/11 Derek <[email protected]>
>>>>
>>>>> and how much ram and CPU does a simple wsgi server use?
>>>>>
>>>>> --
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "web2py-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> For more options, visit 
>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> []'s
>>>> Marco Tulio
>>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@**googlegroups.com.
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> []'s
>> Marco Tulio
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to