VisualVM: Monitoring Remote JVM Over SSH (JMX Or Not)

(Disclaimer: Based on personal experience and little research, the information might be incomplete.)

VisualVM is a great tool for monitoring JVM (5.0+) regarding memory usage, threads, GC, MBeans etc. Let's see how to use it over SSH to monitor (or even profile, using its sampler) a remote JVM either with JMX or without it.

This post is based on Sun JVM 1.6 running on Ubuntu 10 and VisualVM 1.3.3.


Continue reading →

Enabling JMX Monitoring for Hadoop And Hive

Hadoop's NameNode and JobTracker expose interesting metrics and statistics over the JMX. Hive seems not to expose anything intersting but it still might be useful to monitor its JVM or do simpler profiling/sampling on it. Let's see how to enable JMX and how to access it securely, over SSH.


Continue reading →

The Best Code I Have Ever Written Is The Code I Never Wrote

The best code I have ever written is the code I never wrote. It works exactly as intended. There are no bugs, ever. It doesn't increase complexity of the application. Other people don't need to struggle to understand it. It gets never outdated.

Continue reading →

Programming Like Kent Beck

Republished from blog.iterate.no with the permission of my co-authors Stig Bergestad and Krzysztof Grodzicki.

Three of us, namely Stig, Krzysztof, and Jakub, have had the pleasure of spending a week with Kent Beck during Iterate Code Camp 2012, working together on a project and learning programming best practices. We would like to share the valuable lessons that we have learnt and that made us better programmers (or so we would like to think at least).


Continue reading →

(Unit) Testing Swiss Knife: All the Tools You Wanted to Know

I love testing. And I like productivity. There are many tools and libraries that make writing tests easier, more convenient, more fun. I would like to introduce here those that I found the most useful during the years, from selected advanced features of JUnit to assertion libraries, powerful behavior/fault injection, testing of database-related code, and finally to boosting your testing productivity hundredfold with Groovy.

This post accompanies my JavaZone 2012 lightning talk and goes more in depth and introduces additional tools and tips.


Continue reading →

Help, My Code Isn't Testable! Do I Need to Fix the Design?

Our code is often untestable because there is no easy way to "sense1" the results in a good way and because the code depends on external data/functionality without making it possible to replace or modify these during a test (it's missing a seam2, i.e. a place where the behavior of the code can be changed without modifying the code itself). In such cases the best thing to do is to fix the design to make the code testable instead of trying to write a brittle and slow integration test. Let's see an example of such code and how to fix it.


Continue reading →

Most interesting links of August '12

Recommended Readings


Continue reading →

Tip: How to Easily Customize PMD Rules in Eclipse

The default PMD rules are little too strict for me (especially when starting on a legacy project) so I need to adjust them, usually by decreasing priority to warning. It's however quite difficult to find the rule responsible for an error message unless you know how to do it. The answer is the PMD Violations Overview view, which lists the rule names (such as "ConstructorCallsOverridableMethod", as opposed to the error message such as "Overridable method 'addSummaryPeriod' called during object construction").


Continue reading →

Recommended Book: Real World Java EE Night Hacks by Adam Bien

Real World Java EE Night Hacks - Dissecting the Business Tier, Adam Bien, 2011, ISBN 9780557078325.

I highly recommend this very thin and down-to-the-earth-practical book to everybody interested in back-end Java (a basic knowledge of servlets, Java ORM, and REST might be useful). The book evolves around a small but realistic project (X-Ray), which we follow from the inception through couple of iterations til the end. Bien shows us how lean Java EE can be, how to profit from the functionality that it offers, and how these pieces of functionality fit together to deliver something useful. He actually introduces a complete Java EE development environment including continuous integration (CI), code quality analysis, functional and stress testing.

Some of the things that I appreciate most in the book is that we can follow author's decision process with respect to implementation options (such as SOAP vs. REST vs. Hessian etc., a REST library vs. sockets, or when (not) to use asynchronous processing) and that we can see the evolution of the design from an initial  version that failed through cycles of growing and refactoring and eventually introducing new technologies and patterns (events, configuration over convention) to support new and increased requirements.
Continue reading →

Minimalistic Practical Introduction to Puppet (Not Only) For Vagrant Users

I couldn't find any good, brief, practical introduction into Puppet that gives you basic working knowledge in minimal time, so here it is. You will learn how to do the elementary things with Puppet - install packages, copy files, start services, execute commands. I won't go into Puppet installation, nodes, etc. as this introduction focuses on the users of Vagrant, which comes with Puppet pre-installed and working in the serverless configuration.


Continue reading →

You're Writing the Wrong Software - You Never Know What Users Want Until You Ask Them

Too often companies and IT departments believe that they know what software they should create. However users often need and want something different than you believe, even if you're a domain expert yourself. My colleague and dear friend Ivar had exactly this experience when designing a meal planning tool for his girlfriend and himself. He knew everything perfectly - the previous tool they've used (a paper on the fridge), the problem domain, the users. Yet the first prototype tested did not at all match the ideas of what he thought was needed.


Continue reading →

Zabbix: Fixing Active Checks to Work With Zabbix Proxy

We've recently changed our Zabbix 1.8.1 setup to include Zabbix Proxy, which broke all our active checks (f.ex. monitoring of log files). The solution seems to be having the proxy first, before the Zabbix Server, in the Zabbix Agent's config parameter Server, i.e. "Server=<proxy ip>,<server ip>".


Continue reading →

How to Add MapRed-Only Node to Hadoop

I was surprised not to be able to google an answer to this so I want to record my findings here. To add (a.k.a. commision) a node to Hadoop cluster that should be used only for map-reduce tasks and not for storing data, you have multiple options:
  1. Do not start the datanode service on the node
  2. If you've configured Hadoop to allow only nodes on its whitelist files to connect to it then add it to the file pointed to by the property mapred.hosts but not to the file in dfs.hosts.
  3. Otherwise add the node to the DFS' blacklist, i.e. file pointed to by the property dfs.hosts.exclude and execute hadoop dfsadmin -refreshNodes on the namenode to apply it.

Continue reading →

Most interesting links of July '12

A brief one due to (thanks to?) holiday and an accompanying surprising lack of enthusiasm for the technical stuff.

Recommended Readings


Continue reading →

Book Review: Implementation Patterns

Implementation Patterns, Kent Beck, 2007, ISBN 0321413091.


Summary: Should you read the book? Yes, the chapter on principles and values is trully enlightening. The book in general contains pearls of wisdom hidden in the mud of "I know that already, man." I would thus recommend skimming through the book and reading only the pieces matching your level and needs.

The book seems to be targeted a lot at Java beginners (especially the chapter on collections), going into otherwise unnecessary details, yet there are many valuable advises of which some can only be appreciated by somebody with multiple years of professional programming experience. It thus seems to me that the book isn't a perfect match for anybody but everybody will find there many useful ideas. It would best be split in two.

An experienced developer will already know many of the patterns though it's perhaps useful to see them named and described explicitly and listed next to each - it helps to be aware and clearer of what you do and why you do it.

I'd absolutely recommend everybody to read the chapter A Theory of Programming, explaining Kent's style of programming and the underlying key values of communication, simplicity and flexibility as well as the more concrete principles (local consequence, minimize repetition, logic and data together, symmetry, declarative expression, co-locating data and logic having the same rate of change). Also in the rest of the book there are valuable ideas that it would be a pity to miss. I list below some of those that I found particularly interesting.

Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob