Monday, 2 May 2011

nginx, rails and ubuntu - 502 bad gateway

We were getting tons of 502 errors under load, but then I stumbled across a posting in a news group.

cat /proc/sys/net/core/somaxconn

Will show you how many connections you can have. This should be 1024, because Phusion Passenger is hard coded for this value. Mine was 128!

Do this:
sudo sysctl -w net.core.somaxconn=1024

And then restart nginx.

Sunday, 1 May 2011

get-flash-videos and osx (off topic)

I travel a lot and want to watch tv shows from the UK while I am doing so. There is get_iplayer that works nicely to get BBC shows, but on occasion there are things on itv (!) I watch. For this I use 'get-flash-videos'.

I had a tough time getting this working on OSX, so in a nutshell here is what I did:

1) Get 'get-flash-videos'
The home page is here. You pull that down somewhere onto your mac (I have it in a Downloads/get-flash-videos directory).

2) Update perl!
This is the key! I know nothing about perl, but here is what I did:
perl -MCPAN -e shell

This brings up a perl shell. Perl seems to have a package manager called CPAN. You will need to update this:
install Bundle::CPAN

Then you need to install Digest:SHA and Compress:ZLIB:
install Digest::SHA1
install Compress::Zlib

3) FLVStreamer and rtmpdump
Installing FLVStreamer is non-trivial and there are other guides about that.
I download rtmpdump from here
chmod +x rtmpdump
sudo cp rtmpdump /usr/local/bin/.

4) Grab video!
now you should be able to do something like:

And have it pull down an mp4. I use Handbrake to convert it for playing on the ipad.