2 ms·
>In Rails, a process is short-lived by design (the lifecycle of a request). I'm not sure if this is by design, or a limitation of Ruby. >short-lived processes
by pessimizer 13y ago
>In Rails, a process is short-lived by design (the lifecycle of a request).
I'm not sure if this is by design, or a limitation of Ruby.
>short-lived processes aren't the best approach for a web service.
Not for me - I'm building all of my web services in Erlang these days, and there's little to no relationship between the life of most processes in the service and the life of requests. Although each request is usually serviced by its own process, that process may interact with other processes that may have been alive for as long as the application has been running. For example, my RAM caching strategies are usually written as part of the application, not put in front of them. Makes pseudo-ESI easy to hand-roll.
Also, short lived processes may have been spawned by long lived processes, so changing how they're created can be done without taking anything down.
I find this style so much more performant than the one thread per request thing from Ruby, Perl, PHP et al. It's very easy and natural to minimize the amount of time spent in the db (which is where I'm usually bound.)
- phamilton 13y agoThis is exactly the type of response I was looking for. A few questions and comments: 1. RAM caching - I can see a big benefit to keeping cache in Erlang. No marshaling of data to and from memcached, for example. How do you handle eviction? 2. Avoiding the db - I'm going to guess this ties in with RAM caching. Are you doing a write through cache or something like that? Thanks for your response, it's helping it all to come together for me.