I love winter
(8:41 pm) Tags: [General, Life, Why I like...]My 3 year old son was putting on his mittens and said “I need my snow hands”.
Nothing like a little snow to make you miss actual seasons
Popularity: 63%
Code Coverage in Eclipse with EclEmma
(8:38 am) Tags: [Software, Projects]I am fortunate enough to be working on a project where I get to start from a clean slate. I set up test cases using JUnit, and Eclipse runs them within the IDE easily. Next I wanted to know how well the unit tests were covering the code.
Enter EclEmma, an Eclipse plugin for showing code coverage. Simply add the update site of update.eclemma.org/ to your sites, and install/restart Eclipse. Next, run your test case with the EclEmma run button, and you get a report of code coverage. It even highlights the code in the Java editor to show no/partial/full coverage of a line.
This is the way an Eclipse plugin should operate. Great work, EclEmma team! Now, if it only tested a webapp… I know I can do it manually, but this simple ‘click here’ experience leaves me not wanting to do that.
Popularity: 75%
Sum all numbers in a file
(11:06 am) Tags: [Software, Why I like..., How do I..., Sysadmin]You HAVE to love the elegance of unix and the utilities contained therein:
awk '{ sum += $1; } END { print sum; }'
Popularity: 81%
keepalived: who needs a redundant load balancer setup?
(3:31 pm) Tags: [Software, Why I like..., Projects]I was recently tasked with some performance work for a client. Their production web application written in CakePHP was having serious speed/load issues, so I jumped in and took a look.
After some initial testing, I determined that the load balancer serving HTTPS traffic to 2 web servers was only allowing 10 requests/second through, while each web server individually would handle more than double that. I set up a simple SSL/mod_proxy using apache from my own colocated server, and the throughput jumped fourfold to over 40 requests/sec. After checking all was well with the hosting company’s rented load balancer, we decided to ditch it.
I set up a simple load balancing solution using the proxy capabilities of nginx, proxying back to Apache. I did this so I could be sure that the Apache config was untouched. After getting that set up, and seeing the performance come back to expectations, I was then asked by the client to make it redundant (with failover).
I did some quick research, and found keepalived, a small project that is part of the larger Linux Virtual Server project. The best config I found was actually found in docs for haproxy, ironic.
vrrp_script chk_haproxy { # Requires keepalived-1.1.13
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 101 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.1.1
}
track_script {
chk_haproxy
}
}
I modified the virtual ip address, and the check script to look for ‘nginx’, and bammo, it just worked, right out of the box.
I am pleased with the simple configuration of keepalived, and that is ‘just worked’.
Popularity: 93%
Book Review: Lighttpd by Andre Bogus
(2:39 pm) Tags: [General, Why I like...]I was asked by PacktPub to write a review of their new book on lighttpd, Lighttpd by Andre Bogus. It has taken a while to get this one up the queue, but I was pleased.
Overall, the book is a great introduction to using lighttpd as a web server, and PacktPub has even allowed me to attach Chapter 10, Migration From Apache, for your browsing enjoyment.
Like all other PacktPub books I have bought, the book is on target with the title, and while they all have just a few editorial snafus, it doesn’t stop from getting the point across.
Comparing and contrasting to my own experience with lighttpd, I found I knew most of the book, with exception of the excellent chapters on Using Lua with Lighttpd (Chatper 12), and writing your own modules (Chapter 13).
If you are looking for a book to get you going on Lighttpd, this would be the one I would recommend.
Popularity: 75%
sparse revisions in subversion
(9:38 am) Tags: [Software]Finally, an easy way to keep the root folder checked out, but only check out a few subfolders.
svn co --depth=empty
is the best new feature in svn 1.5, bar none. Check out more info here and here.
Popularity: 79%
DimDim mini-review
(12:14 pm) Tags: [Software]We tried out a company conference call using DimDim yesterday morning, and here is a mini-review.
Pros
- The Price is right
- Works equally on Mac, Windows, and Linux
- PPT/PDF sharing feature is nice
- Quick and painless install
Cons
- Screen sharing is SLOWWWWWW (unbearably, and unusably so)
Looks like we will have to stay with our current crap solution that we have, because screen sharing is our 90% use case.
Popularity: 74%
Tango Patch Day
(2:19 pm) Tags: [D Programming Language]Today was my day for patching up Tango, and I managed to make a good dent in getting Tango working on 64bit with GDC. As of svn revision 4235, I am compiling and running my programs on 64 bit Ubuntu 8.10 with GDC and tango.
Now to go see if I can get Mango going on 64bit.
Popularity: 78%
WebSVN install
(3:59 pm) Tags: [Software]Installed WebSVN this afternoon for the corporate svn repository, and from the first use, it is one fast little script.
We were using Trac in the past, but I feel for svn browsing, WebSVN is going to become the de-facto standard.
Install was simple, just unzip, copy the sample config to your own, and edit a few options.
Popularity: 74%
rsync backups with TeraStation
(11:41 am) Tags: [Software, Life]I just successfully set up a backup for my laptop to the home TeraStation, using instructions I found here.
If you just generically want to start using rsync to do backups, there is a great resource here.
I am already backing up via SVN for the really important stuff, and SVN backs up to S3, so I am covered there.
At work, we are using JungleDisk Workgroup to back up home folders, and that seems to be working out fairly well.
It feels good to start the new year with a backup…
Popularity: 78%
Full 1920×1200 screen resolution on Dell Latitude E6500 with Ubuntu 8.10
(2:23 pm) Tags: [Software]I am temporarily stepping away from Vista after some lockups that can’t be diagnosed to software or hardware. I downloaded the ubuntu 8.10 CD ISO from the torrent, burned it onto a CD, and rebooted the laptop.
Install took about 15 minutes, after which I was up and running in Ubuntu. Great compatibilty work, congrats to everyone in the community that makes stuff like this happen for people like me.
Once booted into Ubuntu, I thought the screen resolution was a bit off, so I checked, and sure enough, my Latitude E6500 with 15.4 inch 1920×1200 screen was running at 1280×1024. I tried running the screen resolution utility, but to no avail.
I found this post showing how to get it working, and these are the steps that I followed:
- Open a terminal
- Type:
sudo apt-get install envyng-gtk
- Once installed, type
sudo envyng -t
- Follow the prompts (I installed the recommended nVidia driver)
- Reboot as it recommends
- The laptop now boots at 1920×1200 resoution natively. Beautiful!
Having been a heavy CentOS/RedHat user, I am looking forward to learning the ways of Ubuntu.
Popularity: 76%
Comments working again
(6:56 pm) Tags: [General]I had forgotten to re-enable the comments posting script when I started posting again regularly. If anyone has tried to comment and not been able to, I do apologize, it should be working now.
Popularity: 81%
Why is D/Tango so fast at parsing XML?
(9:05 am) Tags: [General, Projects, D Programming Language]I have been getting questions concerning the performance of Tango in the XML benchmarks I have been running, with people wondering how something that is not C/C++ could be so fast. “They must be cheating!”
This post intends to explain how D, and subsequently Tango, can perform so well, even against C/C++. To read more about D, please visit the home page for D - D Programming Language. Tango is an alternate ’standard’ library for the D programming language, with a design philosophy of building a great library, with extensive documentation, and providing the greatest functionality in the most efficient manner possible. How do they do that you ask?
- Array slicing - Using D’s array slicing feature, you don’t need to create a copy of a string in parsing. Tango maps the DOM nodes directly onto the input buffer, so for any part of the XML, only one text version exists, that being the input. VTD-XML does something similar, and RapidXml does similar, but actually mutates the input buffer while parsing, so creates one copy before starting the parse. Java6 SAX, on the other hand, turns character arrays into strings for element and attribute names, etc, and that means more allocation.
- Native code - Yes, yes, I know. C/C++ are native as well. I write this because Java is not, and while todays’ JIT can compete and in cases outrun native code, if you are allocating hundreds of megabytes during processing, you are going to slow down in garbage collection. D is native code, to be fast right out of the gate, but also uses garbage collection. This just shows that the approach to design is MORE important than the choice of language. You will note that RapidXml is competing on speed, but when it comes to competing on efficency (speed/ram used), it loses, because it copies the input buffer to modify it during parse. Both RapidXml and Tango use internally managed freelists for nodes in the tree. One tweak to the RapidXml design could improve its efficiency an order of magnitude.
- Avoid heap allocation as much as possible - More allocation means more CPU time. Tango’s internal philosophy is one in which you allocate as little as possible, and allocate on the stack if possible. This makes the code much faster.
- Design choices - Tango XML has made specific design decisions which affect the speed, but can impact the ability of the parser compared to the parser that you are used to using today. For example, Tango XML, in its fastest incarnation, does NOT do entity decoding. If you are down at a system level, and you are building some xml proxy, you don’t need to do this. These sorts of design decisions are starting to show in the fastest/newest xml parsers. RapidXml fastest configuration does the same. Java StaX parsers have an option for the same. These sorts of omissions by design can be layered on top of the existing parser, so that YOU can make the tradeoff between speed and a particular feature. It seems as though good librar