Thoughts and tutorials on programming

Wednesday, August 05, 2009

how to compile ruby with increased garbage size

You may have noticed when you're running long-ish rails processes in windows that it sometimes pauses briefly, then continues on its merry way.

I have, at least.

The problem can be attributed to the garbage collector.
Ex: with one operation large_table.find(:all).each{||...}

I would receive something like 10 0.10 second pauses before it finished--increasing my overall time by at least 25%

Tweaking the malloc limit [the amount it will grow before doing a GC limit] changed that to something like 2 0.25 second pauses--which caused things to speedup considerably.


How:
install msysgit
c:> git://github.com/oneclick/rubyinstaller.git
cd rubyinstaller
set CCFLAGS=-DGC_MALLOC_LIMIT=60000000
rake # build ruby 1.8 in sandbox/ruby18_mingw
rake ruby19 # build ruby 1.9 in sandbox/ruby19_mingw

Installers hopefully coming soon.

Another option for speeding things up is building with GCC 4.4 instead of the 3.4.5 currently used.
Here's a download that does that for the adventurous:

http://all.faithpromotingstories.org/ruby_distros/ruby19_mingw_44.tgz

Anyway, watch this area as I'll post various ruby executables with different (faster) compiler options, and experimental like using tcmalloc, etc.
Thanks and good luck to all your windows+ruby users (like myself) out there!

Also much thanks to Luis and the one click group for making it possible to use these cool tools.

=r

Monday, August 03, 2009

how to proxy to a port when your firewall blocks that port [using mod_proxy instead]

For me, it was getting some external server to forward all requests on to that port.

I realize you can use ssh -Rport:host:port as well (through some other server), however ssh tunnelling was at times interrupted and didn't have a retry or restart, it seemed, at least that I knew of.

Anyway the final forward was:

1) create new subdomain that will forward it on.

2) edit apache's conf [apache.conf in my example] to forward things on

Order deny,allow
Allow from all
ServerName audio-mp3.ibiblio.org.8000.doachristianturndaily.info
ProxyPass / http://audio-mp3.ibiblio.org:8000/
DocumentRoot /home/rdp/www/faithpromotingstories.org

Order deny,allow

Allow from all

ServerName audio-mp3.ibiblio.org.8000.doachristianturndaily.info

ProxyPass / http://audio-mp3.ibiblio.org:8000/

3) install forwarders:

sudo a2enmod proxy

sudo a2enmod proxy_http

4) restart apache

5) enjoy the tunes [in my case].

Saturday, August 01, 2009

how to setup a remote git repository using ssh

Finding the normal instructions slightly lacking on how to create a brand-new, empty git repository via SSH for a central location, here they are:


$ ssh myserver.com
Welcome to myserver.com!
$ mkdir /var/git/myapp.git && cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
$ exit
Bye!

Add the remote repository to your existing local git repo and push:

$ cd ~/Sites
$ mkdir myapp
$ git init
$ git remote add origin ssh://myserver.com/var/git/myapp.git
$ touch README
$ git add README
$ git commit -m "initial commit"
$ git push origin master

Contributors

Followers