try

import time, logging

def testing():
    t0=time.time()
    orders = db(db.orders.id > 0).select()
    logging.info('time to fetch %s' % (time.time()-t0))
    return orders

so you can isolate the problem and see if it is in fetching or
somewhere else (for example session locking).


On Dec 2, 4:21 pm, Kenneth Lundström <[email protected]>
wrote:
>  > When you test is that the only active connection to the db?
>
> I tested it on an application running on the test instance. There could
> have been lite activity one production site.
> But when I tested loading the same function five times in about 10
> minutes I allways 39 seconds to load the data.
>
> Kenneth
>
>
>
> > 2010/12/2 Kenneth Lundström<[email protected]>:
> >>> Please tell us more about the setup. Are the three instances behind
> >>> running on the same server?
> >> Yes.
>
> >>> why three? What do they do?
> >> One is production, one is testing and last one is development. I had two
> >> instances running on a virtual server before and it worked fine.
>
> >>> This is not normal but I suspect the problem is with database.
> >>> Did you set DAL(...,pool_size=10)?
> >> No, but I tried but no change.
>
> >> If I try to select more rows:
> >> def testing():
> >>     orders = db(db.orders.id>  0).select()
> >>     return orders
>
> >> It takes 80 seconds to return 1608 rows.
>
> >> If I change the return to return len(troops) it only takes 1,5 seconds.
>
> >> I have no view defined, just trying out the database.
>
> >> Kenneth
>
> >>> On Dec 2, 5:13 am, Kenneth Lundström<[email protected]>
> >>> wrote:
> >>>> Hello list,
>
> >>>> need some help finding out why my server is so slow.
>
> >>>> The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
> >>>> CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
> >>>> The server is dedicated to web2py, there is three instances of web2py
> >>>> running.
>
> >>>> I have migrate=False, sessions on disc.
>
> >>>> If I try the following code
>
> >>>> def testing():
> >>>>       customers = db(db.customer.id>    0).select()
> >>>>       return customers
>
> >>>> takes 39 seconds, 5 times in a row, to return 979 rows.
>
> >>>> If I put db.customer<    100 it takes 4,5 seconds to return 87 rows.
>
> >>>> Is it just me or are this a bit long times?
>
> >>>> Kenneth
>
>

Reply via email to