Avi Bryant: MagLev recap
avibryant.com
avibryant.com
As I understand it, coding in Smalltalk involves developing code in an 'image' that is persisted to disk when you exit (sort of as if it dumps the entire memory contents to disk in a binary form that can be read back in). What sort of applications is Smalltalk suitable for? I know Seaside is a web framework, but a lot of the examples I can find show off more traditional GUI apps.
Does the image approach mean that Smalltalk is not really suitable for quick and dirty sys admin type scripts that you would use Perl or Ruby for?
I am fairly sure that HN doesn't use a traditional DB - and that if I recall PG said that Viaweb didn't either. With Viaweb, when a user logged into their admin console it loaded their environment into a process (and process memory) and kept it there (I think I read that somewhere).
Does that mean that each user had their own Lisp process fired up and kept around, and that data was just kept in process memory (and important stuff persisted to disk somehow)?
What I was thinking then is that if you had a web-app like Basecamp for instance (ie, an Account with no shared data between accounts), would it be technically feasible to have a different Smalltalk image for every single account that is loaded only when that account is being used, with basically all the account data inside the image? I am thinking memory could be a serious limiting factor here!
Sorry for the long rambling post - just trying to get my head around this stuff - hopefully someone on here knows something about it ...
No, it's not, but that's what we have Ruby for. :-)
> would it be technically feasible to have a different Smalltalk image for every single account that is loaded only when that account is being used, with basically all the account data inside the image?
I think that that is how DabbleDB works today. They have a different image for every account.
Avi's post from March about how Gemstone works has a good overview of things: http://www.avibryant.com/2008/03/ive-had-a-numbe.html
Each customer gets his own image, though the customers data is stored outside the image using an image segment. This lets them upgrade the Dabble image without messing with the customers data. When an image fires up, it loads up any image segments into it.
Basecamp is also exactly the kind of app that fits well with this architecture. Lot's of small independent databases.
It's not that different from how Hacker News uses load-table to store the customer data in files and loads everything into ram when the web server starts up. Both systems are basically homebrew object databases very well for the limited load placed on them. Gemstone is the granddaddy ODB that can handle anything you can throw at it.
Unfortunately, it isn't FOSS.
RScheme and other persistent language implementations have certainly been able to use the underlying OS paging mechanism pretty efficiently, and the performance numbers Varnish HTTP cache seems to suggest that it can work well for some kinds of web application workloads, too.
What of parallel projects on other Smalltalk VMs? It would be good for the Ruby community to have options. Gemstone might want to keep some sort of competitive advantage, however. (Email this userid at yahoo.com. Linkedin is not letting me send you a message, and so fulfilling their policy of keeping out riff-raf.)
How hard would be it be to 'marshal out' the entire running Ruby VM to a binary image and load it back in again like the way the Smalltalk VMs seem to do, or add the ability to marshal out objects as a memory image of some sort, meaning they can be marshalled out and in really efficiently (ie stuff a true Ruby object into Memcached instead of a string representation of it ...
Image-based development is a very different style, however. Lots of people are in love with their command lines and text editors.
Also, there was a variant of Smalltalk built in the days just before and after the ParcPlace/Digitalk merger that was designed to be usable for writing quick and dirty admin apps. The minimal image was tiny. Something like 45k.
In any case, there doesn't need to be any barrier to non-image based development in such a virtual machine. Just about any virtual machine has an image in memory. Image based development is about being able to code in the debugger -- about having absolute runtime power over all aspects of the development environment. If you don't need 100% of that, then you don't need image-based development in any virtual machine.
(Because Smalltalk went whole-hog into having this absolute runtime power over everything, even the dev environment, the image became a strange loop, and could not be rebuilt from source due to these chicken-egg paradoxes. But since you already have an image, it doesn't matter. Example: nil is an instance of UndefinedObject, a subclass of Object, whose superclass is nil.)
Another one is MetaClass. Class and MetaClass are both (eventual) subclasses of Behavior. But the Class of Class is an instance of MetaClass. (I'm confused as to why the Rubinius people have MetaClass as a subclass of Class.)
Familiarity breeds contempt, doesn't it?