Persistence Blues

After almost 2 years into my current project, it hasn’t been a week without a hiccup involving JPA and Hibernate. I’m not claiming that Hibernate or JPA are bad tools, nor would I drop it completely for every project, but let’s face it – sometimes it can be the cause of frameworkitis – as a colleague once brought up.

ORM tools sound like a very good idea from an architectural level. No JDBC mapping code to write, relationship management with cascading and all, a powerful query language, all for free. Well, that’s the problem: it’s not for free, at least not outside the sweet spot.

I’ve found that, for JPA (and classic Hibernate), the sweet spot lies in small web applications NOT using EJBs, nor doing any java-based remoting, such as AMF’s or GWT’s RPC. It might also work for pure java desktop applications, such as ALL.com’s.

When you introduce JPA to the Java EE stack though, things start to crumble. First of all, you can’t cheat by following the “Session per Request” pattern suggested by the Hibernate folks – THERE IS NO GLOBAL REQUEST CONTEXT in an EJB. So you get the EntityManager injected by the container into your EJBs, but when you go over a @Remote interface… Whoops, LazyInitializationException! Same goes for things being used by your java web application, be it JSP, JSF, Servlet, or anything else based.

You can fix that by using only @Local interfaces for intra-EJB communication, but then you loose the nice scalability benefits of EJBs, which are the main reason why I use them (or maybe second to free TX). Let me elaborate a bit on this.

Suppose your OrderService invokes your CustomerService for retrieving billing details. If you use a @Local interface, the CustomerService NEEDS to reside on the same VM as your OrderService. If you used a @Remote interface, it could be at any point in your cluster. Doesn’t make sense? Think of this, in an enterprise, the CRM, the e-Commerce and the Backoffice systems all could share the same CustomerService, thus it would make sense to give it more resources, or host it on faster hardware than the OrderService. Making more sense now?

Now the second problem is client/server communication. If things can go wrong inside the Java EE cluster, think of how wrong they could go when you go over the network. Sending an entity over the wire then receiving it back from the client gets it detached from your persistence context. Your collections, entities and everything related to persistence can go cuckoo over that. I’ve had all sorts of errors on this, from LazyInitializationExceptions to insane “transient object found” on relationships, to not even being able to call em.remove on entities sent by the client. This holds true for RMI, BlazeDS / AMF and GWT RPC, and also over XML with JAXB. I’m quite sure the same would happen over JSON or Message Bindings or any other communication protocol, it’s just the nature of the beast.

Now if all that hasn’t scared you yet, there’s relationships and their impact on performance. Lazy load it  -  you’ll say. Well, easy if you’re in the sweet spot, but outside… BAM, LazyInitializationException, or no values being sent to the client.

Even with lazy loading, performance suffers due to AOP proxying and the such. I’ve recently reconstructed a query that took 5 minutes to load with Hibernate by using plain JDBC and manual mapping to objects, and the same query runs in 0.6 seconds.

Having to run over the objects generated by Hibernate to remove the proxied collections and variables before sending it over RMI, AMF or GWT RPC can double your processing time, as I experienced when using Gilead, and later on using beanlib in my own custom adapter for AMF.

The only solution to this is having a DTO to every domain object you have, so instead of writing Object / Relational mapping code, you write Domain / DTO mapping code, yay! That’s how my last GWT project ended up.

So here’s my word of warning: Skip JPA unless you’re going to use it in it’s sweet spot. If you’re building a Java web application (be it using Seam, JSPs, JSF, Tiles, Wicket, Struts, or whatever other technology) using Spring,Guice or POJO backend components, then by all means do use it. Everyone else, think twice before jumping in the fire.

On the positive side, I will follow up with some ideas on how to break JPA blues on the next post this weekend.

Disagree? COMMENT!

How to set-up VNC without a window manager

It’s a server, who needs GUI anway?

Some good utilities require a graphical display to be used. One good example is aptitude, which lets you browse apt packages, or jconsole, a java process monitoring dashboard.

It’s UNIX man, just use X

The problem is, if that application updates the screen too much and you’re over a bad connection, X isn’t really effective in sending screen updates over the wire. Even with ssh compression and X authentication disabled, it can be pretty slow.

Gotcha. Any better solutions?

Enter VNC. VNC runs an X server in the remote server, and allows remote hosts to connect to it via a VNC viewer application (I use Chicken of the VNC for Mac). It’s protocol is very much optimized for low bandwidth connections, resorting to lower color depth and region-based updates to improve on sending data to the clients.

But VNC requires a window manager, and that’s heavy!

Sure, running a window manager in a UNIX box is a waste of precious memory and other resources, that could be better used by the server’s main application, be it a database, web server, application server, etc. But VNC doesn’t need one!

How-to

  1. Install a VNC server in your server. I’m using RHEL5, so I used yum: yum install tightvnc-server-1.3.9-3.el5.rf.x86_64
  2. Connect to the remote server using ssh. Set up a tunnel on port 5900 (VNC for display :0): ssh user@host -L5900:localhost:5900
  3. Start a VNC server in the background using display 0: Xvnc :0 &
  4. Set your ssh session’s display to be display 0: export DISPLAY=”:0″
  5. Run your GUI application/tool. I’m using jconsole: jconsole
  6. Now on your workstation, launch your VNC Viewer, and connect to localhost
  7. Enjoy faster screen updates over the remote connection ;-)
Please leave a comment if this was useful for you. I googled around for this yesterday and only recommendation I got was using xfce or some other lightweight window manager.

New team, new project, new country

Finally time for an update on this blog.

I am writing this from an hotel room in Belgium, and while I am still establishing myself around here, the work side of things is taking off!

Since last October I have been flirting with D Square, a Belgian data mining startup company, with the interest of becoming the lead architect for their new, innovative and core software product. We have finally come to an agreement and all the necessary paperwork is done, so here I am, Sint-Niklaas (for the time being), Oost-Vlaanderen, Flemish Region, Belgium.

The company is on the second round of Venture Capital raising, with already some very solid local venture companies on their board, a solid recognition for their capability to deliver solutions in the services department, and highly acclaimed management team.

The project is named M2IS, and will revolutionize the data mining software scenario in the process industry. More information about the product can be found at the company website.

I am really excited about this project. After stressing over the subject of agile methodologies, we decided to adopt SCRUM and Extreme Programming as the center guidelines for our development team. We are using test driven development, continuous integration, continuous deployment, and a no nonsense approach to the agile practices.

Here is our pretty iteration board.

Some may call it kanban, but we are not adopting any Lean concepts right now, so I would not call it that. It serves as a big, visual reference for the tasks. It has the power to provide a sense of urgency to get the tasks moved to the done column, but also a very rewarding feeling when we do move them.

To those using considering doing this using post-its, one word of caution (well, maybe 2) – adhesive tape. Use a small piece on each post-it to glue them to the wall/whiteboard, or they will fall. We had an unpleasant surprise after we finished setting our first iteration up and cards started falling off.

This team has so far been the best I have worked with. The daily meetings are actually “daily coffee breaks”; and things just come out naturally, without having to stick to the usual formula of “What did you do yesterday, what do you plan to do today and what is blocking you”. We obviously address those topics, but no one actually asks those questions, it just flows.

We are still only 3 people on the team, and things may change when we scale up, but right now, even XP practices that people have a hard time with, such as pair programming, just flow naturally, with 2 of us working together most of the time, but switching pairs frequently. Tasks are chosen, not assigned, and while only one person is held responsible for one task, everyone is willing to help in order to see the burndown chart plot move closer to the x axis.

I will describe how the project bootstrapping was handled in the next post this month, and also the lessons learned from our first iteration. Stay tuned and thanks for reading!

Dragonlance – The Animation

January 24th. When the sun went down on a sunday night, there I was with a lot to do on my hands, but a will to procrastinate.

Wandering through the depths of YouTube, I have found out that there’s been a Dragonlance animation movie out since 2007. I couldn’t resist the impulse. On I went to find a torrent of it, with little luck, but my good lord Google came upon me with this finding from Mega Upload, and on I went to download.

Hereby I feel the need for a good mention towards the Mega Upload crew. The download went blazing fast at all the speed my 6MB cable can hanlde, and in 30 minutes I had the movie in my hands.

Ok, enough with the Rorschach thing, I promise lol.

I was really excited about watching a movie made from the great first Dragonlance trilogy, but man, what a deception!

First thing worth mention is the awesomely crappy job the 20-name 3D animators / modelers team pulled off. The draconians look like they’ve come out of 1996 3D game, and the dragons look plastic. The animations are completely flawed and the rendering with little to no shadowing at all. They’ve used this lame excuse of a 3D production for the entire introduction to the movie, some scenarios, AND all draconians and dragons. Did I mention it sucks yet? Because it totally does.

Next, the voice acting. Have you ever seen a video game with bad, overly done voice acting? It’s the same feeling you get from the Dragonlance animation. The acting is either completely empty on role interpreting, or completely overdone. The voices don’t match the characters all too well, except for maybe Tasslehoff and Flint, but even those two suffer from the overacting.

Then you’ve got the 2D character animations. The frame rate is so low it had myself  looking for performance problems in my computer, as most of the time it seems like the movie is doing frame skipping. And no, it wasn’t my computer AT ALL. This is a simple Xvid encoded file with mp3 audio, even hardware DVD players can handle it just fine.

As a finishing touch, they’ve cut the story short in all good moments from the book, from the escape from Solace, to the visit to the black dragon, it’s all butchered, cut, and thrown together in what feels absolutely shallow. They also butchered the story itself, having Goldmoon kill the black dragon instead of finding the temple of Mishakal, and becoming a priest out of nowhere. She doesn’t save Riverwind either, she ends up saving Tanis from death.

Did I mention they give you in the greatest finding about the whole story, that Fizban is Paladine, by the end of the first book? And also completely out of nowhere!

Unfortunately this was one project with a huge potential that turned out into the same piece of shit quality standard of the other D&D franchise movies. I just hope they don’t do this to Icewind Dale anytime soon.

Music the web 2.0 way

We all heard about how the music business is on its knees due to illegal downloading of copyrighted music on the internet. Yes, the MP3 revolutionized the way people consume and listen to music. Yes, the decade 2000-2010 was the one that saw widespread access to all sorts of music, everywhere in the world. Thats not news by now is it?

What is really new and fresh but maybe not unexpected, and not as widely known, is how the internet is revolutionizing music creation. For those of you not familiar with how music is created and recorded, allow me to take you through a brief journey through music technology and its evolution from the 80s to the current decade. For those of you familiar with digital recording, please skip ahead, or stick with me for a laugh or two.

Music recording for dummies

So, how does one record music anyway? Well you don’t just throw a couple microphones at a band, ask them to play the song, and record it to tape. Well you could, but it would not be “record quality” as we know it. Usually each of the musicians play their parts separately, listening to a guide track recorded with the whole band live. Drums are recorded first, then guitars or the bass, depends on the genre and the producer, and finally vocals.

Recording in the 80s

Ahhh the 80s. In all its flashy green and bold pink glory. Those were the days. I only lived my childhood in them, so all I’m saying here is from my own research, and none from my experience  - well except for the green and pink stuff… I wore that (doh!) .

During the 80s, what you played, was what went into the tape. Wait, did I just say TAPE???. Hell yeah, fucking tapes. Large tape reels that you placed into a machine the size of the desk your computer is sitting over. Digital music making was still in its infancy, and the best thing we had were MIDI sequencers, where you could have a crappy synthesizer play the parts you composed with a bunch of fizzy sounds produced with Frequency Modulation (FM).

What does that mean? If you screwed any little tiny bit of your playing, you would have to play the whole thing again. Or at least a big part of it. It also meant that the machines that handled up to 24 simultaneous tracks (parts/instruments)  costed a very huge sum of money.

All mixing – the process of making individual tracks fit together and form a real song, adjusting volume, pan (Left or Right), EQ, among other things – was done manually in a mixing desk. All effects, such as delay (echoing), reverb (ambiance. the difference between singing out in the open an in your bathroom), compression,  etc, were applied using rack units, with each of them also costing a premium.

So basically, recording gear was expensive as hell, the recording process was lengthy and tiring to boot, mixing required very fast hands  and lots of money on effects units and mixing desks. All that made recording completely out of reach to the general public, or average garage band Joe.

The 90s – Digital audio takes off

Well, over came the 90s, and with them, some technological evolutions. First of all, wavetable synthesizers, the technology still in use by the likes of Roland, Yamaha, Korg, Alesis, etc, came up in the 90s, allowing synthesizers to reproduce more faithfully the sound of other instruments. It was the era of synth pop, made famous by the likes of A-HA, Madonna, Michael Jackson, among others.  Many records dropped the use of real, acoustic drums,  bass and other instruments, and used synthesizers to replace them. It was A LOT cheaper. Recording drums can be a tedious, lengthy and expensive process.

It was also the decade that saw the advent of the dreaded multi-effects units. Those digital processor backed units were capable of doing several different effects (delay, reverb, compression, chorus, etc),  all in one cost-effective, space saving box. Can you hear the mixing costs dropping? Tcha-ching!

Also on the 90s, there was the advent of the small, affordable mixers. The leader of the pack who came up with these products was Mackie, and by making mixers affordable, it made live sound cheaper, but also the mixing process cheaper.  The small mixers packed  less than their “studio” counterparts, bearing usually between 8 and 24 channels, as opposed to hundreds of channels in a “standard” studio mixer. Overall, it made one more part of the equation accessible by mortals.

Last but not least, the two most important technology advances of the decade in recording, the PortaStudio (ok ok, 4-track recorder), and the ADAT recorder. Also the most important one  in playback and distribution:  the CD.

The PortaStudio was a device pioneered by TASCAM, but copied by several other manufacturers, that allowed you to record up to 4 distinct tracks to a regular cassette tape. It was at the heart of any musician’s “demo recording” rig. It had an embedded 4 channel mixer, and microphone and line inputs, allowing one to record anything from synths to vocals to even drums. The sound quality wasn’t GREAT, but it allowed one to record instruments separately, making one-man productions feasible.

The ADAT recorder was a device the size of a video cassete player, that used video-cassete sized tapes to record up to 8 tracks digitally. They could be easily edited by a method called “Punch-in Punch-out” where you overwrite only part of a track when recording. Those recorders could also be synced with other units, allowing for an endless amount of tracks to be recorded and played back simultaneously. ADATs were at the heart of the Project Studios – studios that offered budget prices to record your band with near pro quality. Very useful for unsigned bands and more polished demos.

The CD is something very familiar to us all, but it was the CD recorder advent in the late 90s, that made quality recording distribution possible. Demo “tapes” didn’t need to be tapes anymore, they could be demo CDs – 44khz – 16bit pristine quality audio.  You could record to ADAT, mix in a Mackie mixer with multi-fx units, and then burn it to a CD.

Quite a lot for a decade eh?

A New Millenium – The digital audio workstation and the infamous ProTools

As much as the ADATs made recording cheaper, it was still out of the league of garage bands and regular musicians. Studio time was now a lot cheaper, due to the birth of project studios, but it was still costly for most.

Still during the 90s, computers benefited from the widespread adoption of Sound Cards. In case you don’t know, it’s the sound card in your computer (although nowadays it’s unlikely to be a real “card”, just yet another processor in your motherboard) that reproduces anything you hear from your computer.

The sound card made possible not only to listen to sound from your PC, but also to record it. It was just a matter of time before software was built to record and playback multiple tracks. Companies known for their MIDI Sequencers, such as Cakewalk and Steinberg, started upgrading their software to work not only with MIDI, but also audio. Soon, most major sequencers supported multi-track audio recording and playback, and thus the DAW – Digital Audio Workstation – was born. Hardware was created to support it, along with software that exploited the hardware, and the most well known platform of that sort is ProTools.

The major changes to the recording process using a DAW were in the editing field. It was now possible to edit parts visually, copy them, repeat them, anything you can do in a word processor was now possible with audio. But that’s only one side of the story.

What DAWs also did was enabling the average musician to use their home computer to record demos, without the need to buy ANY extra gear. No more PortaStudios. No more ADATs. No more MIXERS! All DAWs had built-in mixers to adjust the levels of the parts being played, and as long as you didn’t need to do any processing of the sound outside of the computer, any regular sound card would do. All of a sudden, the cost of recording demos was brought to practically ZERO. You could record with a computer mic, and still get passable sound.

I myself have gone through quite some DAW evolution. My first setup was Cakewalk 8, my trusty SoundBlaster AWE 32, its internal synthesizer for drums and bass, and my guitar through my trusty mini-Marshall MS-4 inside a shoebox, miced up with a computer microphone. Did it sound professional? Not at all. But still I could get my song ideas down and show to my band mates.

I later on upgraded my sound card to a Guillemot MAXI Studio ISIS (8 in, 8 out), bought a Spirit Folio F1 Mixer (the ISIS didn’t have microphone preamps, so I bought the mixer to use the MIC pres), and a couple of pro-level CAD and Shure microphones. The results were impressive, and could compete with studio recordings done in the 80s and early 90s.  I did a couple recordings, and with under $1000 USD I had a recording setup that rivaled top studios.

Then there was the advent of software instruments and guitar amp modelling, but the ISIS didn’t make it through the upgrade from Winblowz 98 to 2000 and then XP. I didn’t record a lot of drums back then, so I went with a simple Sound Blaster Live sound card, where I plugged in my mixer output. I used Cakewalk SONAR, then moved to Cubase SX, Amplitube and ReValver for my guitars, Sonic Implants BlueJay soundfont for drums, and a free sound font I found on the net for bass. My Synths were powered by the Native Instruments software synths, the B4 being my pride and joy.

Nowadays there’s not much change to this. I’ve changed the SB Live for an M-Audio Fast Track due to me dropping the desktop for a laptop, and bought a Fractal Audio Axe-FX to get rid of the “modeler” sound the other software gave me for guitars, bought a real bass, changed the drum soundfont for EZDrummer, but all in all it’s all the same.  Microphones got cheaper, and sound cards now have built-in mic pres, so you don’t even need a mixer anymore.

90s and 2000s – The MP3 and broadband internet

This is the last part of the background info. I promise it is!  I’m glad you made it this far. So back in the 90s most people used internet on dial up. And on dial up, the very BEST transfer rate you could get was 5k/s. At that rate, a regular 5 minute sound file, in WAV format, would take around 4 hours to transfer to someone else. Actually, you wouldn’t do that, because it was just a total pain in the back.

What made sound file sharing possible, was the MP3 format. MP3 “compression” (more on this later) turned 40mb WAV files into 5MB ones, with no noticeable loss in quality. MP3 relies on a psychoaural model, which roughly discards the information in the wave that our ears and brain don’t process.

So a 5mb file was much better, you could send a song to someone on dial up in about 30 minutes.

The advent and widespread adoption of broadband, made possible that songs could be sent in under 5 minutes, meaning they could be streamed – listened to while the download was still active. You can now listen to pretty much any band you like on myspace, or youtube. You can listen to hi-quality mp3 from new artists at Soundclick.

So what? What does all this babble have to do with web 2.0?

Even with all the technology improvements, you were still limited to collaborating with other musicians that lived near you, or at least, that were in the same physical space as you were (maybe on a phone call, but you wouldn’t hear anything properly).

Well, now that:

  1. Recording is cheap
  2. Sending files is effortless
  3. Music can be streamed

the technical factors for collaborating with other musicians online are all in place. The stars are aligned, the moon is eclipsed, and it is time. The only thing missing was software. Until recently.

I present you  3 internet-based offerings for colaboration with other musicians online, that have been developed only in the late 2000s.

eJamming – A platform for jamming with other people online, in real-time! eJamming allows you to jam to up to 3 other people in real time, with minimum latency (provided you’re in an acceptable distance from each other and have all the bandwidth necessary).  You log in, create or join a session, and jam away. With someone from Alaska. Or China. Or Africa. Endless possibilities in real-time, brought to you by technology.

Indaba MusicA web-based platform for music recording and creation in a collaborative fashion. Basically you log in, join or create a session, and contribute a new instrument part, or a new idea, or lyrics, whatever to a song. Or have other people do that to one of your songs. Again, endless, worldwide possibilities. Indaba is mainly used by hip-hop and electronic music musicians, but there’s also room for all other genres. The other day I took part on a session where Mark Miller – from Talas fame, played with Billy Sheehan (Mr Big) – recorded the drum parts!

KompozSame as indaba, although with a more rock and metal – oriented community.

It’s such a good time to live in if you’re a musician. You can collaborate, create and expand your horizons without even leaving your own home. I’m totally addicted to those tools and to collaboration.

It’s the end of this blog as we know it

Well well. It’s been months since I’ve last written an entry here. Lots going on in life, but that’s a lame excuse for not writing.

Truth is, I’ve been extremely busy with a lot of exciting projects, finding out new stuff, and mostly, exploring aspects of life other than coding (Yes, there is life after Java after all).

So I guess it’s time for a change. This blog is no longer going to be only about programming. It’s gonna be my own personal sketchbook about findings in all areas of life.

It’s about time I take it where it should’ve gone from the beginning, the reason why I chose the title The Magister’s Terrace: writing about gaming, music, life, AND coding.

I’m sorry to let my previous followers down (anybody out there?), there seems to be some 20 people that actually read the garbage I write. Time to move on.

Resistance is futile, you will be assimilated.

Should you be using an ESB?

A while ago I’ve posted a little article after watching a ThoughtWorker giving a presentation on InfoQ stating that no one needs an ESB, and that if you do need one, use squid.

Althought it is a very extreme point of view, it is definetly a valid one. Web Services, SOAP and WS-* specifications were all built with federation in mind. What does that mean exactly? In one easy sentence, “mind your own business”. Federation fosters and encourages integrations that are in fact point-to-point, but in a standardized and controllable manner.

The promise of ESBs is adding in easy management to those apparently “wild” services, and making changes of service location and versions transparent to the end users. Allowing for multiple protocols, and solving impedance mismatches between application data formats is another one of their advertised uses.

Some time has passed since that infamous blog post, and I’ve had contact with some more real world SOA, and specially ESB deployment. It turns out most ESBs are actually service containers in disguise, with some routing and transformation capabilities.

Some pepople are using ESBs or tools like Weblogic Integration to accomplish service orchestration and composition.  Orchestration engines, most notably BPEL-based ones such as Apache ODE or Progress Sonic BPEL Server are a lot more capable and appropriate for those tasks, making joining message parts for instance, effortless. Trying to achieve that in an ESB such as Progress Sonic ESB, Mule or Apache Synapse is not only not recommended, but a huge effort.

Nevertheless, most people seem to think of ESBs as service containers. They build new services around text files, old apps, databases, and host them in the ESB. How far is this from, say, a JCA container? Too close to consider it a “service hub”, I’d say. Most ESB deployments don’t treat the ESB as a router, but as a container for services. Even the recent SCA and JBI specs, and the so-called JBI ESBs (OpenESB, Apache ServiceMix) are nothing but service containers with routing capabilities as a second thought.

Isn’t it about time we agree to live with the idea of the service container instead, and decide that we don’t need a router or “central point of contact” in SOA deployments?

Mulesource’s Ross Mason has written a very nice blog post regarding wether you should use and ESB or not. Although he won’t go as far as I did in this post questioning the real need for the tools, his questions can set you on the right track.

I’d love to hear thoughts on the subject and discuss it, here or somewhere else. Just shoot me a comment or email.

MySQL data migration

I’ve been working with MySQL throughout my career (11 years and still going strong), and have grown to really love it and favor it over any other database out there. It’s rock solid, stable, and with MySQL 5 it also gained clustering capabilities.

As a developer, refactoring is comething I do pretty often. Renaming classes, methods, creating new ones, killing some others (Shotgun Surgery is a great refactoring standard). When it comes to the data structure in the database, things are not so simple. Usually you have yoru own development database, a testing server with its own database, and a production server, also with its own database.

Keeping those in sync can be a pain if you’re not disciplined enough to generate SQL scripts from all your actions in the mysql console or phpMyAdmin.  Mysqldiff proposes to be a solution to this pain by allowing you to diff a table in two different databases and generate the SQL needed for syncing them.

But what about data migrations? For one of my projects, we just realized that two of the entities we were using, Academic History and Professional History actually belong to a common shared model, History. They were spread in two tables, but since I’m using CakePHP for this one project, it’s easier to manage the inheritance if it’s all in a single table.

I found out that MySQL allows you to use a nested select in insert statements, thus making it really easy to migrate the data from those 2 tables into the shared one:


INSERT INTO history (profile_id,type,organization,start_year,
end_year,position,description)
SELECT p.profile_id, 'Professional', p.company, p.start_year,
p.end_year, position, description
FROM professional_histories p;

INSERT INTO history (profile_id,type,organization,start_year,
end_year,level_id, degree_id, field, area)
SELECT a.profile_id, 'Academic', a.institution, a.start_year, a.end_year,
a.level_id, a.degree_id, a.field, a.area
FROM academic_histories a;

DROP TABLE academic_histories;
DROP TABLE professional_histories;

Nifty isn’t it?

Linux Memory usage

I just stumbled upon an excellent blog article on how to interpret linux memory usage. While one might think that linux is a memory hog by looking at the Free Memory stats at /proc/meminfo or the “top” utility, it actually caches as much as it can of the memory, that being the main reason why it almost never pushes memory back to the “Free” ammount.

http://sourcefrog.net/weblog/software/linux-kernel/free-mem.html