Multiprocess versus Multithreaded... or why Java infects Unix with the Windows mindset
erikengbrecht.blogspot.com
erikengbrecht.blogspot.com
Threading is hard. I've written thread-oriented code and process-oriented code. The process-oriented code was far easier to develop and debug. Issues in threaded code are difficult to reproduce and even harder to fix.
I've been on both the OS engineering team and the app development team across several corporations. In a large managed Java environment, the OS team is powerless to stop a runaway process. To the OS, all that business logic is enapsulated in one giant opaque container. The kill -9 and fuser ommands are barbaric ways to manage your sensitive computing needs. Unix broke away from the monolithic style of development, but the Enterprise Java culture embraces it. On the other hand, the app development team can live in its own little world, not trusting the OS and reinventing wheel after wheel.
These days it's apparent that Unix has won the OS wars, at least on the server side. With Unix, you can trust your operating system. Take advantage of it. It has amazing reliability and if you can just work with it instead of against it, you reap many benefits.
Now we just need to convince the app developers that the philosophy of "many small tools working together" is superior to the "one giant tool doing everything". You don't want to be a giant tool, do you?
Second, how do processes help writing web applications? I don't think he understood what frameworks are made for. Not saying that some Java frameworks are not bloated. Most frameworks I know also have only one hook, the method that has been mapped by the routing. What alternative to the "hook approach" does he suggest? What is the essence of the article, except "different is better", without saying how "different" would look like?
Back to the "expensive threads" issue: maybe it is an issue if you want to run CGI scripts from Apache. If you run scripts from a server written in Java, it is not an issue, because the JVM is already running.
Fact is, we have hundreds of JVMs running that have uptimes of months. So really, we don't care about a JVM and app server starting up in 15 seconds. That is short term thinking. I'm rather fond of the long term stability though :)
Java threads are dead easy as threads go. However, I don't believe that they're going to be a sustainable solution as we move forward. As processor counts keep rising and the focus moves from scaling up to scaling out we need to find more easily understood and debuggable abstractions for dealing with a massively parallel world.
I much prefer Python+C or Ruby+C pair running on POSIX-compatible OS. It gives you performance, portability and higher level of abstraction provided by Python/Ruby and native speed of C. You are also free to decide and pick between multiprocess/multithreading as well: nothing is forced down your throat.
On a side note, I believe that virtualization and especially paravirtualization make JavaOS or .NETOS obsolete even more, since it gives you a real "OS in the box": I can build my system using any kind of most obscure languages I can think of, package them all inside of a Xen image and deploy with a click of a button.