Pages

Building Social Networking Sites

While some people prefer a public social networking sites like Facebook or MySpace, others prefer a private ones, or private-label sites.

There are many decisions to make when deciding to go with privates social networking sites. If you hate the administrative overhead, there are some “freemium” type of hosting services such as Ning and CollectiveX. Basically you can either a “free” private social networking site with a vender host name like yournetwork.ning.com or yourname.collectivex.com, or you can cough out some monthly subscription fee to use your own domain and some advanced features. And apparently these hosting providers put ads on the free sites to cover their cost (and sometimes to make a profit).

If you want DIY, there are options, too. Some open source packages exist there. Ellg is a PHP based open source social networking framework, and Community Engine is a Rails based one. If you want to stick to OpenSocial standards, Apache’s Shindig is worth looking into. In addition, Shindig has implementations in both Java and PHP. Partuza is an example open source social networking that uses Shindig implementation of PHP.

There is another PHP based open source social networking project called U Center Home. It looks nice. However, I am confused by its license. On their sourceforge page, the license is GPL, while on their corporate site, the license says – “free for personal/non-profit use”.

HTTP Post to a remote server in Ruby

To every ruby developer’s surprise, the built-in Net::HTTP does not support Multipart natively. There are a couple of solutions: write multipart function by yourself, use a third part plugin such as curb or RestClient.

Be aware though. Curb can easily crash your rails if the parameter is not a String. For example, if you have an integer stored in the session, and you pass that to curb directly, then your ruby server will crash. It took me a couple of hours to figure that out…

Migrating to Phusion Passenger

I have been using nginx and mongrel for my rails application on my 256 slice. It has been nice, except administration is becoming a big overhead when considering all the stuff I had to deal with fastcgi scripts for my other PHP applications/domains. 

I liked nginx because of its small footprint, and high performance. However when the administrative cost is getting higher, I start to look for alternatives.

Passenger is nice because of its low administrative overhead. But it does not come cheap – it is a module for apache, meaning I will need to run Apache as my web server. Considering the fact the slice has only 256M memory, it is a hard decision to get rid of nginx and bring back Apache.

Things I had to work on is the MPM portion of Apache configuration. My stock Apache from CentOS uses prefork MPM as the default MPM. When using the default configuration, Apache started too many spare servers which uses substantial amount of memory. As a result, the system was put into swap whenever there is a HTTP request. After lowering MaxSpareServers to 6, Apache and Passenger are doing fine. Swap is never used again and the applications are more responsive. 

Now I am happy.