Shelve operations are very slow and create huge files

Eric Wichterich eric.wichterich at gmx.de
Sun Nov 2 15:47:42 EST 2003


Hello Tim,

> Presumably you will be reading the stored query results hundreds or
> thousands of times - otherwise the fact that it takes 9 sec versus 1
> second doesn't matter. Or maybe you need a faster computer? Or perhaps 
> a
> more relaxed lifestyle?
>

unfortunately, speed does matter in this case. As written before, 
Python is used for webscripting. This means in this special case:
A webuser selects some options and sends the form to a webserver which 
is processed via cgi, then a dynamically generated HTML-page is sent 
back.
Then a second script is called which does some MySQL-Queries and stores 
the result in a persistent object (e.g. a shelve) and returns  a 
dynamically generated HTML-page.
 From this on, the user selects some options on his browser and sends it 
via form to the webserver and awaits his resulting HTML-page. This is 
done as often as needed. And every invocation of the script requires 
the stored query results from step 2 to be read and converted to a 
python dictionary.
I think that over 11 seconds for a _single_ (only me as an user on a 
test server) user is too long to wait for a result webpage to appear 
before being able to continue  working. Now imagine if  approximately 
20-30 users are online using the system  at once on the same webserver. 
Not so good.

But thanks anyway for the tips! I'll just have to keep looking for 
another option.

Cheers,
Eric









More information about the Python-list mailing list