Cucumber Performance 1

Posted by jcnnghm Wed, 23 Feb 2011 22:05:00 GMT

Cucumber with celerity running under capybara and celerity was erroring out with Java OutOfMemory exceptions. In looking to fix the problem, I also decided to look at how various jruby invocation switches would alter the performance.

First, to set your jruby invocation options, in your cucumber environment file, add the following:

require 'culerity'
Culerity.jruby_invocation = 'jruby -J-Xmx2500m -J-Xms2500m -J-Xmn512m'

I recommend setting the Xmx and Xms options, the maximum and minimum Java heap sizes, to the same value, tailored to your environment. Xmn controls the generation size for the garbage collector. 20% or so of the total heap size seems to be the sweet spot, and allows the garbage collector to run effectively over this memory.

While increasing the java heap size temporarily alleviated the issue, it didn’t address it entirely, there seemed to be a memory leak. I started poking around, and found this commit, https://github.com/langalex/culerity/commit/5eb7d6e557f86acdeb865af2180629930629bd26, in the culerity repository. After some experimentation, I settled on adding the following to my environment file:

After do
  if page.driver.is_a?(Capybara::Driver::Culerity)
    page.driver.class.server.clear_proxies
  end
end

clearproxies can be replaced without closebrowsers, but it impacts performance more than clear proxies and increases memory usage. The clear_proxies method frees the rjuby remote object proxies, which in turn allows the garbage collector to reclaim the memory that they occupy. This reduced my overall memory usage for the testing suite by over a gigabyte, and had a very minor runtime improvement. At the same time, I also tried both the –fast and the –server options on the rjuby invocation, and found that they didn’t seem to have any significant positive impact on either memory usage or runtime.

jruby -J-Xmx2500m -J-Xms2500m -J-Xmn512m
Mem 1,066,412MB
19m28.724s
with page.driver.class.server.clear_proxies

Mem 2,111,728MB
19m54.007s
without page.driver.class.server.clear_proxies

Mem 1,549,804MB
23m10.708s
with page.driver.class.server.close_browsers


jruby -J-Xmx2500m -J-Xms2500m -J-Xmn512m --fast --server
Mem 1,068,840MB
21m45.931s
with page.driver.class.server.clear_proxies

Mem 2,945,160MB
21m8.971s
without page.driver.class.server.clear_proxies


jruby -J-Xmx2500m -J-Xms2500m -J-Xmn512m --fast
Mem 1,081,064MB
19m57.935s
with page.driver.class.server.clear_proxies

jruby -J-Xmx2500m -J-Xms2500m -J-Xmn512m --server
Mem 1,089,388MB
20m14.662s
with page.driver.class.server.clear_proxies

This wasn’t scientific, but it did stop cucumber from leaking so much memory.

Windows Home Server Not Starting Automatic Backups

Posted by jcnnghm Wed, 23 Feb 2011 08:57:00 GMT

I began experiencing an issue where Windows Home Server was not initiating automatic backups of my Windows 7 Ultimate 64-bit Desktop. I believe that the issues were related to a UPS that was incorrectly reporting that the system was on battery power 100% of the time, even if the system was actually on utility power. To work around the problem, I setup a task in the Task Scheduler to manually initiate an automatic backup. The command to initiate a backup is:

"C:\Program Files\Windows Home Server\BackupEngine.exe" -a

You’ll need to launch the command from an elevated command prompt to get it to work. You can schedule it by opening the Task Scheduler, selecting “Create Basic task”, then following the prompts until you get to Program/Script. Here you enter “C:\Program Files\Windows Home Server\BackupEngine.exe” as the program, and -a as the arguments. Once you complete the remainder of the wizard, the properties for the task will open. From here, make sure “Run with highest privileges” is checked on the General Tab, and “Start the task only if the computer is on AC Power” is unchecked on the Conditions tab. You many also want to check “Run task as soon as possible after a scheduled start is missed” on the settings tab, which will ensure the task runs as soon as it can if there is a missed time.

This process will create a manual task that will initiate WHS automatic backups every day.

Little Things

Posted by jcnnghm Thu, 10 Feb 2011 23:06:00 GMT

Walking around Disney World on a drizzly day, I noticed two employees walking around with large squeegees. My girlfriend and I got in a line, and I kept watching as we waited. Methodically, as if following a predefined course, they traveled from puddle to puddle, brushing pooling water collecting in areas with poor drainage away. I was almost elated to see this, as very few things annoy me as much as stepping into a shallow pool of water that’s just deep enough to coat the surface of a sandal with a slippery, slimy, bothersome coating. With about 65,000 employees involved in their operations, it’s not a significant bother for management to assign staff to clear standing water when it rains, which it tends to do with some regularity in Florida. Most people probably don’t care about such trivial things, but for some small percentage of people, myself included, that particular thing definitely matters. Disney is filled with small details and intricacies that separate the experience at their parks, from the experience anywhere else. Other companies in other industries do this, but Disney probably does it best. If you can perform a large number of little things that make groups of your customers happy, in aggregate you can have a profound effect on the perceived quality of your product or service.

What little things does your company do that create large impacts?