Roads Less Taken

A blend of programming, boats and life.

Preaching Smalltalk Inside a Nuclear Reactor

| Comments

…is what I did yesterday. It was the Stockholm GTUG group having a loose and laid back meetup in a rather special venue - R1, Sweden’s first nuclear reactor)! 27 meters below ground, kinda… funky.

Anyway, I tried doing an ultra compact version of several of my other presentations around Smalltalk and Seaside - didn’t really go 100% since I both had some technical issues (keyboard problems and projector issues too) and ended up taking more time than was planned. Hopefully noone got upset about that.

In about 60 minutes I taught the whole language in 5 slides (the language is very small from a semantic and grammatic view), a bit of the amazing history behind Smalltalk, some of the traditional tools in a classic Smalltalk environment - and finally, a quick whipup of a Todolist app in Seaside, including support for the back button! I used Squeak and Pharo and I hope I get to do a similar presentation some other time - then I will polish it and try to keep the “blitz” tempo. Shock and awe. :)

I think the audience appreciated it (always hard to tell), would have been nice to show more of course - I could easily spend a whole day teaching Smalltalk and various mind blowing aspects around the environment, the language, cool libraries and techniques - and of course Seaside.

Then I spent some time chatting with my friend Mikael Kindborg (also a Smalltalker at heart) and a couple of his colleagues from Mosync who were actually sponsoring the event with beer, wine and sandwiches. It was a nice evening and it’s always fun to show Smalltalk to people who have never seen it.

Node.js vs Nginx/Squeak, Part 1

| Comments

Hmmm, after seeing the Node.js presentation at Dyncon 2011 I couldn’t help installing Nginx and Blackfoot (SimpleCGI) in a Squeak 4.2 image running on the Cog VM to make some performance tests! In fact I started doing that during the presentation. :)

My first run on Nginx/Squeak looked quite unimpressive. Well, one client doing 1300 req/s to a small helloworld was decent although Node.js handled approximately 2x that. With Nginx we have a two tier solution so a factor of 2 is not really surprising in this trivial case. Top showed similar load, both solutions only seem to consume 8-9% of my CPU power on this box, but the Nginx/Squeak solution of course spreads load between them with approximately 1/3 or 1/4 on nginx.

But jacking up concurrent clients really destroys Nginx/Squeak! How come? I was surprised because my memory of this when I wrote Blackfoot was that it was handling that fairly ok. Trying 50 concurrent clients with Node.js pushes it up to almost 8000 req/s! Quite impressive and it still only uses about 9% of my CPU power. Blackfoot ends up serving less than 1/10nth of that. Now, thinking and looking more closely it is quite obvious - SCGI opens a new connection for each request… ouch. Why on earth did they design SCGI like that? So basically Nginx will hammer Squeak just like we hammer Nginx I guess, and Squeak doesn’t deal with that too nicely.

A small experiment with firing up 3-5 Squeak backends and letting Nginx load balance over them (really simple to do) shows that we can get around this somewhat and scare Blackfoot into serving over 3000 req/s and still not going over 30% CPU. Not that shabby, but still not in the same league as Node.js, but now we know why - we need a solution that holds the connection open between Nginx and the backend.

At this point I wanted to try three things:

  1. What numbers can Nginx on its own produce, just returning a small HelloWorld file?

  2. What numbers can plain KomHttpServer running on Cog produce?

  3. And finally, how does Nginx/AJP/Squeak behave? AJP does keep the connection open I think.

Let’s guess first - plain Nginx should beat Node.js, Kom with Cog is probably not much faster than regular Squeak VM since the issues I believe are in the Socket plugin (and we saw that it didn’t like getting hammered by Nginx), and finally I am hoping AJP puts Squeak at say half Node.js even with 50 concurrent clients, that would be 4000 req/s and I would be darn happy. And of course, with a load balancer on top even more, but that can be done with Node.js also of course. So more on that next time…

Dyncon 2011, Retrospect

| Comments

So it’s monday and I am getting started with work but thought I should try writing a retrospective of Dyncon 2011 during the day. In summary it was a nice and largish crowd (about 85), a spacious and good venue in the middle of the city (office of BWin/Ongame) with a great view from the 11th floor and a good lineup of speakers. Perhaps I am getting old though but having this many speakers doing 40 min presentations for two full days… well, I kinda like to have time to sit down and chat with people and show stuff and so on. Not much time for that, and 40 minutes means that most presentations got stressed for time even though flying on a rather high level. But still, a fun and interesting conference!

For me the most interesting part was talking with Joe Armstrong, it turned out he wanted a bridge between Erlang and Squeak and was looking for someone to write a Socket server for him in Squeak. Funny enough I know quite a lot about that, but more on that in another post. I was also somewhat pleasantly surprised about his knowledge of the Smalltalk community and his view of Smalltalk. I forgot to point him to my “bashing” of his OO article a few years back :)

At the end of the day I would say it was a success but if I were to organize a follow up conference I would try to have a few longer presentations, mixed with a some very short ones. And also put in some other kind of “format” - like a panel debate and also more time to just “hang” together and self organize a bit. Well, just my 2 cents.

Dyncon 2011, Day 2

| Comments

Day one must have ended with lots of beer because people were quite late for day two. 15 minutes late Carl Lerche finally started his Ruby presentation. One thing I found interesting was Ruby Modules vs Monticello extension methods (in some ways I presume this is how Modules are often used - to extend other classes with behavior). Evidently “method extensions” to the class side in Ruby doesn’t work like extensions to the instance side, it does in Smalltalk of course :). Then Carl described ways to still do this, but it looked complex, and also explaining there are lots of “hooks” when messing with the MOP. Is that a good thing? If Rubyists use this a lot, then I presume utter hopeless confusion might occur.

Obviously there is a difference here I think between the Smalltalk and Ruby mindset - in Smalltalk we are always in runtime, but that doesn’t mean we go crazy on the dynamic axis - that would pull the rug out from the development environment and its capabilities in navigating and describing the code base, in much the same way as a macro system does in C/C++. Next part was about various techniques using Ruby blocks, like for example messages taking optional blocks… hmmm, trying to figure out what I think of that. “File.open” was showed as an example. Reading on the net shows that there is a lot of… complexity regarding blocks in Ruby, doesn’t look nice. I hate needless complexity. Evidently Ruby 1.9 is cleaning up blocks - curious if anyone could elaborate on that compared to Smalltalk.

Next up was Tom Hughes-Croucher from Joyent presenting Node.js. In essence this is about hard scaling of network applications. He began by talking about scaling issues with regular forking architectures and V8 and the AreWeFastYet website etc. Javascript is indeed getting an awful lot of performance attention these days and that of course makes it the “assembler of the Internet” and a compelling base platform for more and more things. Although I do understand this I still don’t really see how Node.js would be extremely better than say Nginx + a backend that doesn’t allocate insanely much memory per user session? For example, using Nginx (or Cherokee) with a Squeak backend running AJP, it would be fun to compare performance wise.

Sergi Mansilla then presented Cloud9, a web based IDE for Javascript. Mmmmm, well, I don’t get excited about that because I am a Smalltalker and the things I can do with Squeak/Pharo … sorry, I don’t want it in the browser! What about interactive graphics visualization? Really good browsers? Sure, it can be done, and compared to vim/emacs it might be cool. But I want to be able to hack my IDE for example. It is clearly a really ambitious project though and worth keeping track of since they are pushing the boundaries of what you can do on the web.

Robert Virding doing another presentation around Erlang, similar to the one Joe did yesterday but still different. Focusing more on principles but also with some code examples. Somewhat interesting, but I didn’t follow it too closely.

After lunch Björn Eiderbäck started his presentation on Smalltalk directly in the latest version of VisualWorks from Cincom. The style of Björn’s presentation is to interactively using the Smalltalk environment trying to quickly “dig into” code and using its tools. This style easily gets side tracked but in order to make non Smalltalkers understand the “beauty” of Smalltalk it might be the way to do it in a short period of time, Shock and Awe. :)

The day continues but I am posting this now anyway.

Dyncon 2011, Day 1

| Comments

In place at Dyncon 2011 at Bwin/Ongame in Stockholm. Quite a nice crowd and the day was started with Joe Armstrong presenting Erlang. I had never seen Joe speak before and it was a fun and interesting presentation, although of course only “skimming” some areas. I found it fun that he referenced Alan Kay where he stressed that “it’s the messages”, given his earlier harsh view on OO. I couldn’t help starting to think about how some of Erlang’s concepts could easily be implemented in Smalltalk and what that could give.

Next up was Yehuda Katz presenting Sproutcore. An “all” javascript framework to build “rich” client apps in the browser. Hmmm… there are so many of these now. Claims a proper MVC architecture. But I really don’t want to build my apps in Javascript :). Generating Javascript - yes, writing it - no thanks. And I am really not impressed with frameworks/toolsets that are template oriented with various quirky ways of “binding” stuff together. I have become too spoiled by the HTML DSL approach in Seaside to think template engines are “cool”. Ouch, my eyes hurt!