I'm reading up on strace now.  in the meanwhile, here is the MVC code  (not 
sure if I can attach a file to google groups)….


Model:

-Nothing.  I have an empty model file.  Other than the default settings that 
come with a new controller.  
Ordinarily I am using a Model and writing to the SQLite db.  But this is the 
simplest case I could make that 
still replicates the problem.

View:

-Don't have this either.  I'm only ever returning a json object via REST so 
there's no need for a view.

Controller:  
        You can see some of what normally gets loaded, which I've commented 
out.  I also tried to see if gc or cache would help.  
        I've never used these before though so I may have been doing it 
incorrectly.

the RESTful query would look something like:   
http://domain.com/memclimb/request.json?jo={"Test":"memory"}


"request.py" (controller)...
_______vv______
@request.restful()
#@cache(request.env.path_info,time_expire=10,cache_model=cache.ram)
def test():
  #import gc
  import gluon.contrib.simplejson
  response.view = 'generic.'+request.extension
  #gc.enable()

  def GET(*args,**vars):
    
    jsonObject = request.vars.jo
    obj =  gluon.contrib.simplejson.loads(jsonObject)
    return {'message': 'testing Memory.'}

  #gc.collect()
  return locals()
_______^^________

Only seems to be a problem under high traffic.  So I created this python script 
and ran 10 instances of it from another machine.  
It's common for our site to have >100 trying to hit it at about the same time, 
but I can see the memory climb even with only 10.

"testLoad.py"...
________vv________
#!/usr/bin/env python

import sys
import os
import urllib

def main():
  for i in range(1000):
    result = 
urllib.urlopen('https://domain.com/memclimb/request/test.json?jo={"Test":"memory"}')
    json = result.read()
  print "done…\n\t%s"%json


if __name__ == '__main__':
  main()
__________^^________



On Feb 5, 2013, at 8:30 AM, greaneym wrote:

> Hello,
> In addition sending the model, view, controller code, you can try the 
> following.
> 
> It looks like dreamhost is using debian linux. You can try using the strace 
> command in a shell while your process is running. You can run it against 
> different process ids (pid) to help figure out what is associated with the 
> problem.
> 
> Here is a link that may be useful in running strace.
> http://www.hokstad.com/5-simple-ways-to-troubleshoot-using-strace
> Save the output in a file so you can look at it.
> 
> Also you can run "top" in a shell to see what pid, program is running more 
> than others and that may help you as well.
> 
> 
> 
> 
> -- 
>  
> --- 
> 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+unsubscr...@googlegroups.com.
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to