Posts tagged programming

What does CodingHorror have in common with Apache H-Base?

As I was in my “Advanced data management” class today I realized that CodingHorror aka Jeff Atwood of stackoverflow fame agree quite alot with Apache H-base. Apache H-base is a column-store database system based on the Google BigTable ideas leveraging Apache Hadoop.

Jeff Atwood was is not very happy with the default “incredibly pessimistic out of the box” setup of databases in his “Deadlocked!” post.  Along the same lines, the H-store people published an article[1]:

The End of an Architectural Era (It’s Time for a Complete Rewrite).

They claim that the time is up for “legacy systems” like the model used by current RDMBS’ like MySQL and SQL Server. The assumption of the H-base people that reasonates with Jeff Atwood – I believe – is:

Every effort should be made to eliminate the cost of traditional dynamic locking for concurrency control, which will also be a bottleneck.

I don’t know if it is something Jeff Atwood is aware of, and I don’t know if that is a sign that a traditional RDBMS is maybe not what he wants, but it is worth think about – IMHO.


[1]Stonebraker, M., Madden, S., Abadi, D. J., Harizopoulos, S., Hachem, N., Helland, P., 2007. The end of an architectural era: (it’s time for a complete rewrite). In: VLDB ‘07: Proceedings of the 33rd international conference on Very large data bases. VLDB Endowment, pp. 1150-1160. URL:http://portal.acm.org/citation.cfm?id=1325981 pdfBibtex

Logging vs. debugging

It is probably no news that measurements in an experiment almost by definition affects the experiment. 

This is true also for IT systems, where logging is a very used way for observing running code.

From Jeff Atwoods Coding Horror blog about a problem during the beta of stackoverflow.com:

We spent days troubleshooting these deadlocks by .. wait for it .. adding more logging! Which naturally made the problem worse and even harder to figure out. 

[link: The problem with logging]

This illustrates my point exactly. 99% of the time logging affect the system in a neglible way. But you have to keep in mind that it actually could affect the “experiment”. In this case the performance or the behavior of your program.

 

My job is “Production Support” in the ITIL way. IE. ensuring quality of running services with  Incident Management and Problem Management. That means that for anything not related to normal operations we often need the logs. 

Also in these days of powerful IDEs and remote debugging is that much logging really nescisary?

[link: Stackoverflow: Code to logging ratio]

Yes it is! We are supporting an ESB developed and customized during the last 3-5years and attaching a debugger isn’t really an option. 

So we are basically totally dependent on good logging for troubleshooting.

We have been dealing with a problem relating to big batches of large messages and the 2GB limit of our JVM’s. We started by initiating a project to throw some dedicated hardware after the code handing these large messages so it wouldnt affect the rest of the “stuff” running on the same application server. But unfortunately hardware acquirement and machine setup can be a slow process, and worst of all: It’s out of our hands! :)

So our current guru took a quick look at the code and started grabbing for some low hanging fruit:

Before ifDebugEnabled

Before ifDebugEnabled

After using if debugEnabled

After using if debugEnabled

 It turns out that developer had used the same politic as mentioned in the stackoverflow post:

<…
DEBUG Level

  • Any parameters passed into the method

…>
 

The parameter in this case was 1-2MB xml-data which was logged like this:

LOG.debug("Entering part 2.1 of method MyMethod with msg: "+msg.toXml());

In production only INFO and above is logged so the debug message was discarded. But the concat of 2MB data was still performed several times per message (10-12 as far as I recall). So the difference between the above to memory graphs is:

if (LOG.isDebugEnabled()){
    LOG.debug("Entering part 2.1 of method MyMethod with msg: "+msg.toXml());
}

(as also mentioned here: http://wordstoday.wordpress.com/2007/11/26/log4j-why-use-isdebugenabled-in-your-code/)

This should buy us some time before we can isolate this process on it’s own hardware/jvm.

The guru is currently looking into writing a xpath expression for PMD run over our giant codebase. Could be fun to see what it’ll dig up

What I like about Unit Tests

They are included with the source code, committed to SC and build along with the code  pretty automatically these days!

Actually I dont really care if it’s unit tests, integration tests or any other kind of test, I just see unit tests every day as part of my work. The part I like is that it’s such an integrated part of the code.

When I do a code review, it’s not always possible to just load in the code as a project into my eclipse and run findbugs, pmd, checkstyle and eclemma.

In these cases I go straight to the included testcases to see what is being tested.  I always have the (maybe naive?) faith that by looking at the test I at least get a view of the “main” function of the code parts and that way I can start to dig through the code. This has helped me likewise  when trying to reuse some old code. The unit test showed me very easily how to initalize the functionality, what I need to supply, and what needed to be  present (the mocked out parts). 

So shame on you who don’t write unit tests! (or other kinds of directly included tests).

Fast inverse square root

Beyond3D(Rys) wrote an article (almost a series!) about the history of the magic fast inverse square root found in for example the quake code. With the explantions it doesn’t seem quite that much as magic. As this pdf says, its not magic at all(page2) :)

The history article is all about paying homage to the author(s) and finding the origin. And it really is very very slick way of doing it. The article even uses this as an example of why it’s good that games and software gets release as open source in some form.

I’m just wondering: Why isn’t there any comments in this very sleek code?

If it was me using übercool constants for nice approximations in my code I sure would hope i would comment it!

Java and closures – YAPOJC

YetAnotherPostOnJavaClosures

So, I fell over some articles with both the words closure and java in them this week.

It was this article about JavaFX closures.

Since I’ve done some of my non-mandatory classes in my stud.scient. days (like the last 4years) it kinda woke my interest.

It seems like lots of things has happend in the Java world since I last had any real interest in it (somewhere around 1½ year ago).

Maybe “fell over some articles” is a bit inaccurate. I’ve actually been trying to catch up. My main focus has been on the things I needed in my day-to-day work. That included JUnit and Unit-testing, Spring and the Application Server Enterprisy way of doing things.

Luckily I already spent some time reading up on the concept of SOA.

There is a ton of material online about all these things. Currently(as in the past year) there’s alot of talk about feature request for Java 7. Including closures. I tried to do a “quick” catchup on the subject and decided to share my findings with the world:

As far as I gather there currently exist two proposals:

and as in any other good war on the internet, it seems like we are at a point where religion is the turning point. The CICE people believes that the BGGA is “overly complex”, and will alienate users by “pushing the complexity of the language beyond the point where Joe Java can’t use the language anymore”
Another interesting twist is the fact the Neal Gafter – who I see as the current “main-man” behind BGGA, is working at Google as well as Josh Bloch and Josh Blach is the JCP representative for Google as pointed out by Ricky Clarkson (and down played by Neal Gafter).

So no real catfight there. But among the readers there’s a very Web2.0-ish involvement in the debate. Lots of evangelists on both sides. (I’m a BGGA’er myself! To me it seems like CICE is like sitting between two chairs). Among these debates and blogentries there’s lots of interesting reading (and hearing; podcasts).

Apart from the other links in this post I recommend:

UPDATE: If you need the real thorough easy understandable walkthrough this is a very nice talk by Neal Gafter

If you need even more reading try some of these googlesearches:

Eliteprofessionel!

ADVARSEL: Buzzwords og partisk indlæg!

Jeg har den store glæde at kunne præsentere mig selv som en af de få rå:

Ægte Eliteprofessionel!

Er du klar til at lufte talentet - NetcompanyComputerWorld interview med vores administrerende direktør

At kommentarene til den tilhørende artikel ikke er helt så fine kan ikke ryste mig :)

Man kunne måske mene at eliteprofessionel måske er lidt meget buzzword, men det bakker faktisk meget godt op om hvordan det mærkes at arbejde hos Netcompany. Et konsulentfirma som ved at deres værdi ligger i den summerede værdi af medarbejdere.

Jeg kan kun sige at det er et dejligt sted at være, og har indtil nu været meget inspirende at være en del af “showet”.

Jeg sidder sammen med mange kolleger hos PFA og er javaudvikler i Produktions-Support. Dvs. vi holder infrastrukturproduktionen i luften. Før, under og efter nye releases med hotfixes, bugsøgning, nyudvikling og mange andre fine ord. Jeg har aldrig før prøvet at være med på så store projekter og slet ikke på så store udviklingsprojekter. Voldsomt spændende må jeg sige.

Derudover har vi brug for folk (lige som resten af IT-branchen) men jeg kan med mine 2½uge på bagen ihvertfald på det varmeste anbefale at arbejde for Netcompany :)

Jeg brugte selv lidt tid på research inden jeg var til samtale. At google dem og søge efter dem på diverse sites(CW, Børsen) er ok spændende:

Derudover er der jo altid netcompanys site som faktisk har meget spændende om karriere i Netcompany.

</salgstale>