I did some interesting ab testing with cherokee / apache. Both installed on the same server, running the exact same web2py app. My apache only runs mod_wsgi, no ruby on this server!
At server bootup, visiting the homepage of the app once for apache and once for cherokee, this is the RSS footprint as to ps aux. 5296 Cherokee 25768 uWSGI Total: 49948 Cherokee + uWSGI 56744 Apache 33672 mod_wsgi Total: 90416 Apache + mod_wsgi Now after running the following command (thadeusb.com is apache, thadeusb.com:50002 is cherokee) ab -n 200 -c 15 http://thadeusb.com/weblog && ab -n 200 -c 15 http://thadeusb.com:50002/thadeusb/weblog/ This is the RSS footprints, taken right after this small test. 5954 Cherokee 32120 uWSGI Total: 38074 Cherokee + uWSGI 91252 - Apache 95452 - mod_wsgi Total: 186704 Apache + mod_wsgi All I can say is... good bologna! What has happened to apache and mod_wsgi???? 186MB!!! When Cherokee was at a happy 38MB after this test! Preposterous! Though to give it credit, my real test here is speed, and cherokee is only a tad bit faster at serving web2py apps than apache, so the only real benefit gained by using cherokee over apache is A) Admin interface and B) low memory footprint. Anyways, below are the actual ps aux printouts in order. Before testing: root 2932 0.0 0.4 32604 1440 ? Ssl 00:38 0:00 /usr/sbin/cherokee --admin_child -C /etc/cherokee/cherokee.conf www-data 2936 0.0 1.1 212936 3856 ? Sl 00:38 0:00 /usr/sbin/cherokee-worker --admin_child -C /etc/cherokee/cherokee.conf www-data 2484 0.1 10.2 337836 33672 ? Sl Feb25 0:02 (wsgi:thadeusb) -k start www-data 2929 0.8 7.8 128500 25768 ? S 00:38 0:01 /usr/local/bin/uwsgi -s 127.0.0.1 -t 10 -M -p 1 -C -x /home/thadeusb/web2py/uwsgi.xml root 2467 0.0 2.0 93536 6816 ? Ss Feb25 0:00 /usr/sbin/apache2 -k start www-data 2482 0.0 1.5 232796 5160 ? Sl Feb25 0:00 /usr/sbin/apache2 -k start www-data 2483 0.0 1.5 232796 5160 ? Sl Feb25 0:00 /usr/sbin/apache2 -k start www-data 2486 0.0 1.7 93724 5692 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2537 0.0 1.7 93724 5652 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2538 0.0 1.7 93716 5652 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2539 0.0 1.7 93724 5712 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2540 0.0 1.7 93724 5688 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2648 0.0 1.6 93536 5516 ? S 00:02 0:00 /usr/sbin/apache2 -k start www-data 2665 0.0 1.7 93732 5656 ? S 00:04 0:00 /usr/sbin/apache2 -k start after testing root 2932 0.0 0.2 32604 692 ? Ssl 00:38 0:00 /usr/sbin/cherokee --admin_child -C /etc/cherokee/cherokee.conf www-data 2936 0.0 0.6 215112 2264 ? Sl 00:38 0:00 /usr/sbin/cherokee-worker --admin_child -C /etc/cherokee/cherokee.conf thadeusb 3826 0.0 0.2 7336 876 pts/1 R+ 01:04 0:00 grep cherokee www-data 2929 7.0 7.5 155924 32120 ? S 00:38 1:48 /usr/local/bin/uwsgi -s 127.0.0.1 -t 10 -M -p 1 -C -x /home/thadeusb/web2py/uwsgi.xml www-data 3345 14.2 29.0 550772 95452 ? Sl 00:59 0:36 (wsgi:thadeusb) -k start thadeusb 3828 0.0 0.2 7336 876 pts/1 R+ 01:04 0:00 grep wsgi root 2467 0.0 0.9 93536 3172 ? Ss Feb25 0:00 /usr/sbin/apache2 -k start www-data 2482 0.0 0.5 232796 1832 ? Sl Feb25 0:00 /usr/sbin/apache2 -k start www-data 2483 0.0 0.5 232796 1832 ? Sl Feb25 0:00 /usr/sbin/apache2 -k start www-data 2486 0.0 0.7 93724 2540 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2537 0.0 0.7 93724 2536 ? S Feb25 0:00 /usr/sbin/apache2 -k start www-data 2539 0.0 0.0 0 0 ? Z Feb25 0:00 [apache2] <defunct> www-data 3471 0.0 0.7 93672 2492 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3482 0.0 0.7 93672 2492 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3483 0.0 0.7 93672 2492 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3485 0.0 0.7 93672 2492 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3510 0.0 0.7 93672 2536 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3511 0.0 0.7 93672 2504 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3512 0.0 0.7 93672 2508 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3514 0.0 0.7 93672 2504 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3515 0.0 0.7 93672 2532 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3516 0.0 0.7 93672 2528 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3520 0.0 0.7 93672 2520 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3521 0.0 0.7 93672 2524 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3522 0.0 0.7 93672 2532 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3523 0.0 0.8 93672 2668 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3524 0.0 0.8 93672 2668 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3535 0.0 0.8 93672 2932 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3537 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3538 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3539 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3540 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3541 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3542 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3543 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3545 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3548 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3550 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3551 0.0 0.8 93672 2932 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3552 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start www-data 3555 0.0 0.8 93672 2936 ? S 01:03 0:00 /usr/sbin/apache2 -k start thadeusb 3830 0.0 0.2 7340 884 pts/1 S+ 01:04 0:00 grep apache -Thadeus On Fri, Feb 26, 2010 at 12:36 AM, Thadeus Burgess <thade...@thadeusb.com> wrote: > I was able to get the server started with my SSL pem files. It was > quite easily actually, I just was only putting the path to the .pem > file in one of the text boxes, not both. (silly me) > > Anyways, it seems that uwsgi does not pass the correct > request.env.remote_addr. > > This is the relative information passed to request.env using uwsgi. > running on SSL (firefox displays its nice little blue box around the > domain verifying that I am indeed using my SSL cert, oh and I had to > go through the whole "security exception" thing firefox likes to do) > > 'wsgi_url_scheme': 'http', 'server_name': 'thadeusb.com', 'https': 'on', > > If I alter admin to check for https==on then it works. I am wondering > this must be a bug in uwsgi ? > > if request.env.http_x_forwarded_for or request.env.wsgi_url_scheme\ > in ['https', 'HTTPS'] or request.env.https == 'on': > > Here is the full contents of request.env > > <Storage {'content_length': '0', 'http_user_agent': 'Mozilla/5.0 (X11; > U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) > Firefox/3.5.8', 'script_name': '', 'wsgi_errors': <open file > 'wsgi_input', mode 'w' at 0x24a02d8>, 'server_protocol': 'HTTP/1.1', > 'http_cache_control': 'max-age=0', 'web2py_path': > '/home/thadeusb/web2py', 'http_accept': > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', > 'wsgi_url_scheme': 'http', 'server_name': 'thadeusb.com', > 'remote_port': '42400', 'http_accept_language': 'en-us,en;q=0.5', > 'wsgi_version': (1, 0), 'request_method': 'GET', 'script_url': > '/admin', 'server_port': '50003', 'wsgi_input': <open file > 'wsgi_input', mode 'r' at 0x24a01c8>, 'server_addr': > '174.143.155.212', 'document_root': '/home/thadeusb/web2py', > 'wsgi_multithread': False, 'http_accept_charset': > 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'https': 'on', 'http_cookie': > '__utma=226599768.612546542.1262501624.1267163250.1267163748.37; > __utmz=226599768.1266549488.30.3.utmcsr=sikbox.com|utmccn=(referral)|utmcmd=referral|utmcct=/; > session_id_init=75-27-133-239-23cdebe9-e999-47ca-be3d-57e5b64b0c96; > __utmb=226599768.1.10.1267163748; __utmc=226599768; > session_id_welcome=75-27-133-239-20d264d8-0607-4ef7-ba26-455fd1c21cbb; > session_id_admin=75-27-133-239-550561b2-eaa8-41b2-a962-76595c193823', > 'server_software': 'Cherokee/0.99.43 (Ubuntu)', 'web2py_version': > 'Version 1.75.4 (2010-02-18 14:55:03)\n', 'http_host': > 'thadeusb.com:50003', 'wsgi_multiprocess': False, 'path': > '/bin:/usr/bin:/sbin:/usr/sbin', 'request_uri': '/admin', > 'http_connection': 'keep-alive', 'wsgi_file_wrapper': <built-in > function uwsgi_sendfile>, 'gateway_interface': 'CGI/1.1', > 'http_keep_alive': '300', 'remote_addr': '75.27.133.239', > 'http_accept_encoding': 'gzip,deflate', 'server_signature': > '<address>Cherokee Web Server</address>', 'path_translated': > '/home/thadeusb/web2py/admin', 'query_string': '', 'wsgi_run_once': > False, 'path_info': '/admin'}> > > -Thadeus > > > > > > On Thu, Feb 25, 2010 at 4:46 PM, Thadeus Burgess <thade...@thadeusb.com> > wrote: >> Actually, SSL is not out of the scope of this entry. >> >> How do you expect me to access admin, or appadmin for that matter? >> >> I can't use web2py without SSL :) >> >> I have tried everything but it just keeps giving me an error saying >> something is wrong with my .pem file, but not telling me "what" is >> wrong. I even used the make-cert.sh that comes with cherokee. >> >> -Thadeus >> >> >> >> >> >> On Thu, Feb 25, 2010 at 4:42 PM, GrayMatterComputing >> <battledi...@gmail.com> wrote: >>> The guide is fine, it just needs to be Followed Step By Step without >>> skipping. ;) >>> I also figured the SSL and all was easy enough to find and, again, >>> outside the scope of this entry. >>> >>> On Feb 25, 4:47 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: >>>> The following packages are not installed by the PPA... >>>> >>>> cherokee-doc >>>> libcherokee-mod-geoip >>>> libcherokee-mod-ldap >>>> libcherokee-mod-libssl >>>> libcherokee-mod-mysql >>>> libcherokee-mod-rrd >>>> libcherokee-mod-streaming >>>> >>>> Installing libcherokee-mod-libssl fixes this. >>>> >>>> Also they have a great article on creating and signing your own ssl >>>> key, it seems the one I am using for apache setup is invalid :) >>>> >>>> -Thadeus >>>> >>>> On Thu, Feb 25, 2010 at 3:36 PM, Thadeus Burgess <thade...@thadeusb.com> >>>> wrote: >>>> > Don't forget to hit save :)0 >>>> >>>> > And how to enable SSL, and use my self signed certificate, OR use a >>>> > paid for certificate? >>>> >>>> > -Thadeus >>>> >>>> > On Thu, Feb 25, 2010 at 3:25 PM, Thadeus Burgess <thade...@thadeusb.com> >>>> > wrote: >>>> >> Also, emphasis the fact of using the PPA method of installing, and >>>> >> provide instructions on how to do this, and a link to that page. The >>>> >> reason it was not working was I installed 0.99.19 instead of 0.99.43. >>>> >>>> >> -Thadeus >>>> >>>> >> On Thu, Feb 25, 2010 at 2:27 PM, Thadeus Burgess >>>> >> <thade...@thadeusb.com> wrote: >>>> >>> A couple of suggestions with the slice >>>> >>>> >>> Make a note, for buildinguwsgi, that there are makefile.py25 and >>>> >>> others so that you can build it for the python version that you want. >>>> >>>> >>> Do include the little ``ssh -L 9090:localhost:9090 remote_IP`` trick >>>> >>> to securely connect to cherokee admin. >>>> >>>> >>> I do not seeuWSGIlisted under Wizards->Platforms. I do not see it >>>> >>> anywhere else. >>>> >>>> >>> I can run ``uwsgi`` from command line, so it is installed correctly in >>>> >>> my bin. >>>> >>>> >>> The only difference is I have /web2py and /web2py/config.xml does this >>>> >>> matter? >>>> >>>> >>> -Thadeus >>>> >>>> >>> On Thu, Feb 25, 2010 at 10:07 AM, Thadeus Burgess >>>> >>> <thade...@thadeusb.com> wrote: >>>> >>>> Can I have cherokeeuwsgiand apache mod_wsgi running on the same >>>> >>>> web2py code base or should I make a copy so cherokee can execute it ? >>>> >>>> >>>> You are right I could run cherokee on a non-standard port for testing >>>> >>>> and always switch it over when I am happy with it! >>>> >>>> >>>> -Thadeus >>>> >>>> >>>> On Wed, Feb 24, 2010 at 11:30 PM, GrayMatterComputing >>>> >>>> <battledi...@gmail.com> wrote: >>>> >>>>> @Thadeus >>>> >>>> >>>>> For me, it was a breeze to switch from Apache to Cherokee. I was >>>> >>>>> happy >>>> >>>>> with Apache too, but I used the fact that a client wanted Cherokee as >>>> >>>>> an opportunity to give it a try, and I am glad I did :) Besides, it >>>> >>>>> is >>>> >>>>> not like you would have to remove Apache to use Cherokee, so what are >>>> >>>>> you waiting for (besides possibly a free hour), give it a try! >>>> >>>> >>>>> @mr.freeze and everyone else >>>> >>>> >>>>> This guide has been posted >>>> >>>>> athttp://www.web2pyslices.com/main/slices/take_slice/64 >>>> >>>>> and will appear on graymattercomputing.net in the near future. >>>> >>>> >>>>> On Feb 24, 6:05 am, "mr.freeze" <nat...@freezable.com> wrote: >>>> >>>>>> This is really helpful. Unfortunately, it will be lost on this >>>> >>>>>> mailing >>>> >>>>>> list in a month or so. Care to make a >>>> >>>>>> slice?http://www.web2pyslices.com/main/default/index >>>> >>>> >>>>>> On Feb 23, 2:56 pm, GrayMatterComputing <battledi...@gmail.com> >>>> >>>>>> wrote: >>>> >>>> >>>>>> > web2py with Cherokee viauWSGI: a simple, easy guide >>>> >>>>>> > (written specifically for Ubuntu, but applicable to all systems) >>>> >>>>>> > By: Evan Gray - GrayMatterComputing >>>> >>>> >>>>>> > 1) web2py >>>> >>>>>> > a) Download web2py (found at web2py.com) >>>> >>>>>> > i) Install python, if not present: sudo apt-get install python >>>> >>>>>> > b) Unzip (to /var/web2py) >>>> >>>>>> > c) Run: sudo python /var/web2py/web2py.py -a desiredpassword >>>> >>>>>> > d) Verify that it functions properly (by visiting >>>> >>>>>> > localhost:8000), >>>> >>>>>> > then close the server (Ctrl+C in terminal) >>>> >>>>>> > e) Allow server permission to web2py: sudo chown -hR www-data\: >>>> >>>>>> > /var/ >>>> >>>>>> > web2py >>>> >>>>>> > i) Where "www-data" is Cherokee's effective user (www-data is >>>> >>>>>> > the >>>> >>>>>> > default) >>>> >>>> >>>>>> > 2)uWSGI >>>> >>>>>> > a) DownloaduWSGI(found at projects.unbit.it/uwsgi/) >>>> >>>>>> > b) Unpackage wherever and cd into folder >>>> >>>>>> > i) Install dependencies for make, if not present: sudo apt-get >>>> >>>>>> > install python-dev libxml2-dev >>>> >>>>>> > c) Makeuwsgi: sudo make -f Makefile.Py26 >>>> >>>>>> > d) Install: sudo cp uwsgi26 /usr/local/bin/uwsgi >>>> >>>>>> > e) Create config.xml: sudo cat > /var/web2py/config.xml >>>> >>>>>> > <uwsgi> >>>> >>>>>> > <pythonpath>/var/web2py/</pythonpath> >>>> >>>>>> > <app mountpoint="/"> >>>> >>>>>> > <script>wsgihandler</script> >>>> >>>>>> > </app> >>>> >>>>>> > </uwsgi> >>>> >>>>>> > [PRESS ENTER] >>>> >>>>>> > [PRESS CTRL+D] >>>> >>>> >>>>>> > 3) Cherokee >>>> >>>>>> > a) Install Cherokee (follow the instructions at >>>> >>>>>> > cherokee-project.org) >>>> >>>>>> > i) Note: I highly recommend using the PPA method so you can be >>>> >>>>>> > sure >>>> >>>>>> > to have the latest version and no issues! >>>> >>>>>> > b) Run cherokee-admin: sudo cherokee-admin >>>> >>>>>> > c) Visit admin console (via browser, password is shown in >>>> >>>>>> > terminal): >>>> >>>>>> > localhost:9090 >>>> >>>>>> > d) Go to Virtual Servers, click Wizards, click Platforms, >>>> >>>>>> > clickuWSGI >>>> >>>>>> > i) New Host Name: web2py >>>> >>>>>> > ii) Document Root: /var/web2py >>>> >>>>>> > iii) Configuration File: /var/web2py/config.xml >>>> >>>>>> > iv) Same logs as vserver: default(combined) >>>> >>>>>> > v) Submit >>>> >>>>>> > e) Go to Virtual Servers, click default >>>> >>>>>> > i) Under "Basics", Virtual Server Nickname: original >>>> >>>>>> > f) Go to Virtual Servers, click web2py >>>> >>>>>> > i) Under "Basics", Virtual Server Nickname: default >>>> >>>>>> > ii) Under "Logging", verify all logging is correct (matches >>>> >>>>>> > original) >>>> >>>>>> > g) Go to Virtual Servers >>>> >>>>>> > i) Set original Active to OFF >>>> >>>> >>>>>> > 4) Visit localhost (or your.ip.add.ress from another computer) to >>>> >>>>>> > view >>>> >>>>>> > your web2py site! :D >>>> >>>> >>>>> -- >>>> >>>>> You received this message because you are subscribed to the Google >>>> >>>>> Groups "web2py-users" group. >>>> >>>>> To post to this group, send email to web...@googlegroups.com. >>>> >>>>> To unsubscribe from this group, send email to >>>> >>>>> web2py+unsubscr...@googlegroups.com. >>>> >>>>> For more options, visit this group >>>> >>>>> athttp://groups.google.com/group/web2py?hl=en. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "web2py-users" group. >>> To post to this group, send email to web...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> web2py+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/web2py?hl=en. >>> >>> >> > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.