I'm glad GoLightly's proving useful to someone :)
One of the ideas I'm toying with for a future stable version of the library is compilation of Go to a virtual machine implemented in GoLightly, allowing hot-loading of multiple Go applications within a single process space and replacing conventional IPC with channels. Something similar to OSGi could then be built atop this, with the added benefit that code could be moved fairly easily between processes and/or hosts by supporting operations from the pi-calculus extensions to CSP - an area I definitely want to explore as part of making GoLightly cloud-friendly.
In the meantime it should be relatively simple for Philip to implement a poor-man's OSGi equivalent using the traditional unix process model and monitoring/control via pipes. I recommend Beej's Guide to IPC as a great introduction to the subject.
Ellie
Eleanor McHugh
Games With Brains
http://feyeleanor.tel
----
raise ArgumentError unless @reality.responds_to? :reason
I used to build multiprocess realtime control software and the customary approach for that is to use multiple hosts with a shared watchdog to bring up a new instance immediately when the current active instance terminates. For software upgrades this means upgrading the secondary systems first and then switching one of them in so that the primary can be upgraded, in the process hopefully avoiding any loss of traffic.
On a single host I'd suggest using two or three control processes linked by a named pipe to act as the watchdog. With a hardware watchdog the swap would effectively be instantaneous, but even with a software watchdog you should be able to get the switchover down to a small multiple of the cost to context switch between processes. If possible use the native kernel event interface to monitor the watchdog for changes although old-fashioned polling will work if necessary.
If you were writing in C I'd suggest running multiple processes rather than faffing about with pThreads, but with Go you should be fine spinning off tasks in goroutines and communicating via channels: the marginal cost of launching a goroutine is negligible and I've had more than 900k running concurrently in 2GB or RAM so their base memory consumption is also very acceptable for massively parallel worker architectures. This approach means you've also only got the cost of tearing down a couple of processes when you need to load a new code instance, and likewise when a failover occurs the total costs of recovery are about as minimal as they're going to get.
I'm glad GoLightly's proving useful to someone :)
One of the ideas I'm toying with for a future stable version of the library is compilation of Go to a virtual machine implemented in GoLightly, allowing hot-loading of multiple Go applications within a single process space and replacing conventional IPC with channels. Something similar to OSGi could then be built atop this, with the added benefit that code could be moved fairly easily between processes and/or hosts by supporting operations from the pi-calculus extensions to CSP - an area I definitely want to explore as part of making GoLightly cloud-friendly.
If you were writing in C I'd suggest running multiple processes rather than faffing about with pThreads, but with Go you should be fine spinning off tasks in goroutines and communicating via channels: the marginal cost of launching a goroutine is negligible and I've had more than 900k running concurrently in 2GB or RAM so their base memory consumption is also very acceptable for massively parallel worker architectures. This approach means you've also only got the cost of tearing down a couple of processes when you need to load a new code instance, and likewise when a failover occurs the total costs of recovery are about as minimal as they're going to get.
Well even when it's mature and tightly optimised I doubt RubyGoLightly will be even an order of magnitude faster than standard Ruby for most day-to-day uses. Contrary to popular perception Ruby isn't slow and responds very well to exactly the same multiprocess patterns as any other language that integrates with its host environment (at least when that environment's Unix), and the main speedups I hope to realise in RubyGoLightly are mostly to do with the implicit parallelism in a lot of standard library operations such as Enumerators.
However I do agree the prospect is exciting. Sufficiently so that I ditched commercial work at the end of last year to focus exclusively on GoLightly and related projects >8o
> Loading a new bundle in OSGi is brutally expensive compared to the cost of spawning a new process; there's just a lot of work to be done to open and examine the bundle, construct its classloader and connect up its plumbing. A typical process running a Go program would be up and actually talking over IPC before OSGi got done reading the jar headers. Hm. I feel a little demo project and some slides coming on. This is probably better shown than told.
And another Go addict is born ;)