> Again at Webfaction my memory usage is way over my limit:
>
> Below is the list of processes that you're running with the memory
> that they use (the command used to list these processes is "ps -u
> fitwise -o rss,etime,pid,command"):
>
> User - Memory - Elapsed Time - Pid - Command:
> --------------------------------------------
> fitwise - 1MB - 24 days, 11:45:32 - 30464 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 27MB - 24 days, 11:45:32 - 30465 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 25MB - 24 days, 11:45:32 - 30466 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 25MB - 24 days, 11:45:32 - 30467 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 26MB - 24 days, 11:45:32 - 30468 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 25MB - 24 days, 11:45:32 - 30469 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
> fitwise - 2MB - 24 days, 11:45:32 - 30470 - /home/fitwise/webapps/w2p/
> apache2/bin/httpd.worker -f /home/fitwise/webapps/w2p/apache2/conf/
> httpd.conf -k start
>
> I did this:
>
> Serve static media with a Static-only application.
>
> I did not yet set up Nginx+uwsgi because at Webfaction they said:
> "Using Nginx+uwsgi may reduce your memory usage, but it will involve
> some experimentation with your application." and I don't have much
> time to experiment at the moment.

There is nothing to experiment to with webfaction + uWSGI.

After having installed uWSGI 1.0 (from mercurial and with python2.6)
simply run it with

uwsgi --wsgi-file web2py/wsgihandler.py -m --http-socket :PORT

where PORT is the port assigned by webfaction.

The -m flag report the memory usage after each request, and you can
obviously add flags to automatically respawn instances based on memory
usage.

PAY ATTENTION:

only the 1.0 branch of uWSGI is fully usable in webfaction without nginx
or the --http option, and has support for their HTTPS proxy out of the box
(thanks to the report of a web2py user in this list).

Webfaction guys should really invest some time in uWSGI analysys, as it is
built with their kind of services in mind.

QUICK AND DIRT WAY (from webfaction ssh home)

# install mercurial
easy_install mercurial
hg clone http://projects.unbit.it/hg/uwsgi
cd uwsgi
# compile uwsgi
make -f Makefile.Py26
cd ..
# download web2py
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
cd web2py
# run web2py rocket server to setup password
python2.6 web2py.py
# set your password then kill the server
cp parameters_8080.py parameters_PORT.py
# where PORT is your webfaction port
cd ..
# start uwsgi
./uwsgi/uwsgi --wsgi-file web2py/wsgihandler.py -m --http-socket :PORT

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

Reply via email to