High memory usage in webfaction

167 views
Skip to first unread message

Joseph Jude

unread,
Jan 24, 2012, 9:12:40 PM1/24/12
to web...@googlegroups.com
Dear All,
I was expecting when I am going to get this message from webfaction team and I got it today. I have searched through this group and found that I could use uwsgi server. Before I go ahead and make changes on the site, I got few questions:
1. Currently it is running on apache. How do I make the switch to uwsgi and disable apache?
2. In the error message that webfaction sent, there are processes that running for 23 days (and there are many) and that adds to the memory. How do I know what are the unnecessary processes and kill them?
3. There is a expire_sessions.py in admin app. Does that help and if so, how?

Thank you,
Joseph

Vasile Ermicioi

unread,
Jan 25, 2012, 3:35:10 AM1/25/12
to web...@googlegroups.com
hi,

 Currently it is running on apache. How do I make the switch to uwsgi and disable apache?

go to webfaction panel and do 2 things:
- remove app that is running on top of apache
-  create a custom app listening on a port 

then connect via ssh to your webfaction account and do that

[install web2py]
unzip web2py_src.zip  
python2.7 web2py.py
cd /home/your_user

[install uwsgi]
tar xvzf uwsgi-1.0.2.1.tar.gz
cd uwsgi-1.0.2.1
/home/your_user/bin/python2.7 uwsgiconfig.py --build
mv uwsgi /home/your_user/bin
cd /home/your_user

[start uwsgi]
uwsgi --http 127.0.0.1:your_custom_port --pythonpath /home/your_user /web2py --module wsgihandler -d /home/your_user/tmp/uwsgi.log -t 20 -r --no-orphans -M -p 2 --touch-reload /home/your_user/tmp/uwsgireload.txt --evil-reload-on-rss 100


 How do I know what are the unnecessary processes and kill them?
 
ps -u your_user -o rss,command
that will show you your processes and how much memory they use

ps -u your_user
will show ids of processes

and

kill -9 id_of_process

Joseph Jude

unread,
Jan 25, 2012, 1:34:38 PM1/25/12
to web...@googlegroups.com
oh my god.  The memory usage dropped from 71 mb from 120 mb. webfaction should use this as their default for installing web2py.

I can't thank you enough.

Just one more question:
1. I'm assuming there is no need to restart uwsgi; it automatically does I suppose?

Thank you,
Joseph

Massimo Di Pierro

unread,
Jan 25, 2012, 1:40:37 PM1/25/12
to web2py-users
"dropped from 71 mb from 120 mb"

which of the two numbers has a typo? :-)

Joseph Jude

unread,
Jan 25, 2012, 1:46:02 PM1/25/12
to web...@googlegroups.com
sorry it is midnight here and i am too relieved that it is solved and too excited that now i can get back to 'real' development.

dropped to 71 mb from 120 mb

Vasile Ermicioi

unread,
Jan 25, 2012, 2:02:17 PM1/25/12
to web...@googlegroups.com
I'm assuming there is no need to restart uwsgi; it automatically does I suppose?

 it is started with this command
uwsgi --http 127.0.0.1:your_custom_port --pythonpath /home/your_user /web2py --module wsgihandler -d /home/your_user/tmp/uwsgi.log -t 20 -r --no-orphans -M -p 2 --touch-reload /home/your_user/tmp/uwsgireload.txt --evil-reload-on-rss 100

it is running as a daemon, which means it is still running after you close ssh window (putty in my case)

Joseph Jude

unread,
Jan 25, 2012, 10:05:26 PM1/25/12
to web...@googlegroups.com
can I rotate log (uwsgi.log) with this command? I don't want the log file to go on increasing in size

Roberto De Ioris

unread,
Jan 26, 2012, 1:26:43 AM1/26/12
to web...@googlegroups.com

> can I rotate log (uwsgi.log) with this command? I don't want the log file
> to go on increasing in size


log-maxsize = n

where n is the maximum size in bytes

--
Roberto De Ioris
http://unbit.it

Reply all
Reply to author
Forward
0 new messages