Hi, I am using web2py v2.8.2. My command line to launch web2py is "python web2py -i 0.0.0.0" . I am using python 2.7.5 I have a fair sized dataset, takes about 10sec to load from the datafiles and perform some calc for lookup.
Code is something like this: lookup_data = fn_datalookup(filespath) I want to expose the lookup_data to a few controllers, but i want web2py to load it only once and make it available to controllers that make the request. Yes, global variable. Load once, read many as long as web2py is up. Reason is : I don't want to loose 10sec on every request that needs to work on this dataset. I tried the following: 1. In a new model file: Call gets executed by all controllers, every time, i.e. 10sec loss on every request in the app. Not a recommended approach (based on documentation). Hence not good 2. In specific controllers: Takes 10sec to load on all valid calls, but still not good. I don't want to loose 10sec on all valid requests. During web2py startup, can i load once and make it available as a global read-only? If yes, how? If this has been answered before, please point to the post and i will gladly read and learn from the answered post. My search didn't yield the results. Another problem: I noticed that the memory usage(VSZ, RSS) keeps going up and never came down in both the above cases. i.e. every new call increased the memory usage. I waited for more than an hour (with no activity), still didn't come down Web2py runs as a single process, doesn't spawn any new process on requests.... Where can i find documentation on how web2py allocates and deallocates resources and some best practices when working on long running processes, large datasets. Thanks, Yogesh -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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.

