How I got New Relic working with Thin Async

I recently had to build a small service where performance and reliability were high priorities. Our main app is built on Rails, but for these requirements it really doesn’t make a very good fit. Arguably, perhaps Ruby isn’t a good fit it self, but since the service would be exposing a library already built with Ruby, that was a given. So I decided to try to write the service directly on top on Thin.

Building directly on Thin means very few dependencies, which means fewer things that can go wrong and which means an app that is easier to reason about. This helps with the reliability part. In case you are not aware, Thin is based on Event Machine and uses a reactor pattern for concurrency, rather than threads. Essentially, this means that everything happens within a single thread, with the benefit of being very fast and having a very low resource overhead. This is the same reason why Nginx is able to handle far more concurrent connections than – say – Apache.

Continue reading →