News for hackers. Stuff that matters.

rledge21

All the time. I think about this stuff for every new feature that needs implemented server-side. Our system is very read-heavy(posts need to be circulated into different feeds for users), and all the mysql joins were starting to slow things down. We ended up using redis sets to store post_ids for specific feeds, it speeded things up considerably.
Re:Ask HN : Have you ever programmed with threads? on Friday March 05, 2010 @02:56PM (#1170316)
At least 3 different classes had me using threads at some point(c, pthreads library). I had to write 2 different web servers. Both were multi-threaded. One had to serve static files from a directory, the other needed to implement a simple web service outlined by the teacher. For a separate grade, we had to make the web service one implement a threadpool.

I've also played with Ruby 'threads'(not really threads). For a databases class, I made a simple youtube-like clone that let users upload, tag, and comment on videos. When a video was uploaded, I needed to convert it to a flash-compatible format. I spawned a separate thread to handle this. If there were a bunch of people all uploading around the same time, you would end up with lots of extra threads hanging around converting video. I realized that this idea would never scale when I made it, but the timeframe given for the project didn't really allow me to implement a more scalable solution. I used a library off github called Spawn.

On the subject, I recently saw a great talk by Joe Damato and Aman Gupta at the Ruby Hoedown in Nashville covering different threading models. Some of their code has made it into Ruby Enterprise Edition.