Bourne to be wild


Varnish web accelerator

I just did setup varnish on my machine to see if it makes my web server feels snapier. Facebook uses it so it must mean something... At least now I have some cool HTTP headers on all my request, not sure if it's faster or not. ab gives me pretty lame stats (like 60 request per seconds for a static page with), but maybe it was even lamer without it !

I installed it with aptitude on Ubuntu oneiric, you'll get a varnish 3.x if you do that, and a smooth install as usual. Quick note for myself (apache user). Update yourt ports.conf, and all the virtualhost port to serve on 8080 now (including 000-default.conf), then update /etc/default/varnish to serve on port 80 (it serves on 6081 by default). There is a secure telnet interface for diagnostic (on port 6082). Also, if one of your site uses Cookies you might have to set a magic option (thanks Google) by giving this flag to the varnish daemon when you start it. I think it augment the capacity of the HTTP headers (limited to 2K by default). There's a handy varnishlog tool that will let you know about errors; it's an interactive tool that you use like you'd use top.

-p http_req_hdr_len=20000 -p http_resp_hdr_len=20000 \
 

posted on Sat, 15 Oct 2011 under code


Apache Virtualhost

Here's my apache virtualhost config file for jeandiff. I'm gonna upgrade my Ubuntu Linode VPS from karmic to natty ... so I'd better do some backup.


     ServerAdmin bsergean@gmail.com
     ServerName jeandiff.jeanserge.com
     ServerAlias jeandiff.jeanserge.com
     ErrorLog  /srv/www/jeandiff.jeanserge.com/error.log
     CustomLog /srv/www/jeandiff.jeanserge.com/access.log combined

     # http://reinout.vanrees.org/weblog/2011/05/13/gunicorn-apache-zero-length.html
     # Force http 1.0 for proxying: needed for gunicorn!
     SetEnv force-proxy-request-1.0 1

     DocumentRoot "/srv/www/jeandiff.jeanserge.com/site/idiff"

     ProxyPreserveHost On
     ProxyRequests Off

     ProxyPass        /static/ !
     ProxyPass        / http://localhost:5000/
     ProxyPassReverse / http://localhost:5000/

posted on Mon, 25 Jul 2011 under code


Know your iTunes

Hey iTunes users, I've made this for you !!

It's still very alpha (hint hint ... if any designer want to help...), but it works. You can login with your Facebook account, and I won't post anything on your wall, I swear :)

Check it out !

For the nerd in you, it uses Flask, a super cool Python web framework. The huge database that contains 2 entries on the live site is an SQLite one, and for that project at this point it's all good because it means NO config NO extra server running and that's great.

I used gunicorn for the prod (laugh) site, proxied behing apache. Here's an extract from the amazing Makefile ...

prod:
        # http://gunicorn.org/configure.html
        env/bin/gunicorn -w 4 -b 127.0.0.1:5000 -t 90 -p gunicorn.pid -D hello:app

kill:
        if test -f gunicorn.pid ; then kill `cat gunicorn.pid`; fi

restart: kill prod

posted on Thu, 21 Jul 2011 under code


Find the exit

A while ago I found a maze pic on reddit, and the goal was to paint/find the exit using some coding.

With some python PIL, it was easy to read in the png bytes, but then you had to find the exit ... looks like I found it ;) I still love to zoom in and follow that path to make sure my program is correct and really find a valid path.

posted on Wed, 06 Jul 2011 under code


3D and volumes

Some links worth remembering for later.

posted on Fri, 17 Jun 2011 under code






blog comments powered by Disqus

Made with PyBlosxom
RSS 2.0