probably SOLVED:
**cache view** seems to work ok :)
it improved stats from
 1354ms 1068cpu_ms 582api_cpu_ms
to
 310ms 310cpu_ms 77api_cpu_ms


but if i cache just controller, which returns DIV(...) I get:
PicklingError: Can't pickle <class 'gluon.html.__tag__'>: it's not
found as gluon.html.__tag__

so I needed to:
    return response.render( '{{=view}}', dict(view = DIV(...) ) )

and call  controller with ".load" extension

My silly mistake was to write reQUEST.render at first xD





On 31 Rugp, 09:07, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com>
wrote:
> I looked around once morehttp://www.web2py.com/book/default/chapter/04
> and found that I could "cache view"
>
> * on rockets this seems to have some efect (but profiler won't show
> them, as it counts just the time it is executed - am I rigth?).
>
> * on dev_server this seems quite slower (probably because dev_server
> mimics memcache)
>
> * and on gae for one of controller caches I 
> gethttp://web2py-gae-test.appspot.com/CodeByExample/default/example_view...
>
> PicklingError: Can't pickle <class 'gluon.html.__tag__'>: it's not
> found as gluon.html.__tag__
>
> which comes from somewhere
>   File "/google/appengine/api/memcache/__init__.py", line 194, in
> _validate_encode_value
>     stored_value = do_pickle(value)
>   File "/google/appengine/api/memcache/__init__.py", line 299, in
> DoPickle
>     self._pickler_instance.dump(value)
>
> called from
> @cache(request.env.path_info, time_expire=caching_time,
> cache_model=cache.ram) # cache.ram = cache.memcache
> def example_view_4url():
>     id = int(request.args(0))
>     return example_view(id) # returns DIV(...)
>
> *
> if I remake
> return request.render( example_view(id) )
> or
> return request.render( dict(view = example_view(id) ) )
>
> I get another error - probably, because there is no view
> example_view_4url.html :
>  File "/gluon/cache.py", line 410, in <lambda>
>     return lambda: cache_model(key, func, time_expire)
>   File "/gluon/cache.py", line 182, in __call__
>     value = f()
>   File "/applications/CodeByExample/controllers/default.py", line 790,
> in example_view_4url
>     return request.render( example_view(id) )
> TypeError: 'NoneType' object is not callable
>
> I now use :
> -----------------------------------------------
> VERSION 1.83.1 (2010-08-11 23:52:55)
> --------------------------------------------------
>
> ps.:
>    could @cache generate keys  depending  on  function's argument
> values?
>
> pps: thanks a lot for clues and answers -- i guess I am starting to be
> annoying :]
>
>
>
>
>
> > > Hello,
>
> > > I have my beta apphttp://code.google.com/p/code-by-example/
> > > onhttp://web2py-gae-test.appspot.com/
>
> > > which seems to load quite 
> > > slowlyhttp://ftp.akl.lt/incoming/jurgio/gae-logs.png
>
> > > I also tried logs,http://ftp.akl.lt/incoming/jurgio/cbe.profile.txt
> > > but don't see big problems (though i use profiling for the first
> > > time..)
>
> > > ***
> > > I recently made KEEP_CACHED = True
>
> > > and for Session use Memcache
> > > as I use session quite a bit
>
> > > but still can't feel that its better
>
> > > ***
> > > I also see info in logs:
> > > This request caused a new process to be started for your application,
> > > and thus caused your application code to be loaded for the first time.
> > > This request may thus take longer and use more CPU than a typical
> > > request for your application.
>
> > > ***http://plugins.jquery.com/project/appear
> > > might help me a bit,
> > > as mostly used controller shows ~ 20% of what it loads
>
> > > I tried web2py_component(action,target) {
> > >      $('#'+target).appear(function() {
> > > instead of
> > >      jQuery(document).ready(function(){
> > > but this did' t work :(
>
> > > any suggestions ?

Reply via email to