Tuning Java Garbage Collection

I recently completed a garbage collection exercise on a variety of applications. In all, twenty WebLogic application clusters were tuned. A dozen of these are large busy application clusters. These provide a mix of Web Applications and Web Services.

Tuning garbage collection is a matter of trade-offs. Large heaps take longer to garbage collect. Small heaps need to be collected frequently using more CPU time. Continue reading

Securing TLS

A StackExchange question on using HAProxy’s capture feature to pass data from TCP mode to HTTP mode prompted me to update my SSL configuration. This was intended to get an A+ rating from SSL Labs by sending non-SNI capable clients to a server with weaker ciphers. This was to enable clients on WinXP/IE8, Java 6, and an old Android version to connect. I found a solution without having to have two sets of ciphers and handling traffic in both the TCP mode and HTTP mode. I then optimized my settings to a minimal list of cipher specifications.
Continue reading

WordPress Tuning

I’ve done a little tuning to my WordPress setup. In order to keep up to date, I’ve switched from the Ubuntu installation to a downloaded installation under /opt/wordpress. This is owned by my user and served by apache running as www-data. Updates are done using the sftp add-on.

Securing /opt/wordpress

I added myself to the www-data group. This allow apache to read any files with group access, but prevents writing if the web-server is compromised.

I set the group sticky bit on all the directories. If required, setting it on the wp-content/upgrade directory should be sufficient.


I generated my key outside the home directory for www-data which is /var/www. The directory I chose is not one I would publish. However, ssh requires a .ssh/known_hosts file in its home directory. This was created and the appropriate security added. The key is password protected.

Outstanding Issues

There are some outstanding issues. I’ll look into these as time permits.

Native ssh

The WordPress ssh2 modules does not work on my server. I’ve found a couple of issues.

  • Passwords on the key don’t work. This is a known issue with a work-around. The initial connection appears to fail, but a second call should resolve the issue.
  • The is_dir function does not work. Returning true for paths that end in a slash (/) is a workaround. This got me as far as trying to install. This may be a result of how the path is constructed and there is a published workaround.
  • The is_file function appear to fail as WordPress reports the download contains no files. This is likely the same issue as for the is_dir function.

Theme upgrades

My modifications to the theme are getting a little old. The theme works reasonably well on mobile devices, but I would like to update to a more streamlined theme. The site statistics I have indicate a surprisingly high percentage of viewers use a mobile device.

Command Line Arguments in Python

When I need a new tool, I often code it in Python.  Often, command line options are useful. Sometimes it is possible to have a fixed set of parameters, but this is not very flexible. Fortunately, Python has standard libraries to handle parsing command lines.  There are three libraries providing varying capabilities.  Some of the systems I run on have older versions like Jython 2.1 or Python 2.6.  This limits which libraries I can use without backporting libraries

This document provides examples for four command line processing options.  The examples are for a program that processes files and has an optional argument to report the execution time. Continue reading

Choosing Log Levels

There are many tools available that will allow a programmer to create log entries.  I originally worked with log4j, but have recently been working with logback. I am also working with Jython and am looking at Python’s logging framework. Used well they can make log analysis simple and provide a rich tool for resolving issues. Used poorly they can generate a mass of relatively useless information.

While these loggers have a good hierarchy of levels, the documentation tends to be lacking in guidance on when to use which level. The following document contains the recommendations I have gathered over the years. Continue reading

Tuning Linux CPU Performance

A recent kernel change broke my CPU performance tuning. I have an AMD processor which presents 4 cores to the kernel. The process in this article should work for Intel processors although the governors and CPU settings tree may be different. Different kernels may also have different settings. The current kernel allows setting the governor per CPU, but for an earlier kernel the setting was global.

My system is mostly idle, and I want it to be as quiet as possible. However, from time to time it is busy and I want processing to be as fast as possible. I use a small block of shell code to select a governor and ignore niced programs (such as boinc) in selecting processor speed. Continue reading

Adding SHA-2 to tinyca

Google has announced a sunset for SHA-1 certificate signatures in Chrome. SHA-2 (aka SHA-256, SHA-384, and SHA-512) is the remaining option for certificate signatures. I decided to upgrade my certificates to SHA-2 (256 bits). However, when I tried to use tinyca2 to generate a SHA-2 certificate, I found it was not supported.

As tinyca2 is a Perl package, I looked at the code to see how difficult it would be to update. The code is easy to read and well modularized. Adding the SHA-2 involves changes to the GUI, REQ, CERT, and OpenSSL components. I updated six files, although support can be added with fewer.

Patches are attached at the end of this post.  An additional patch to apply the selected digest when creating sub-CAs (thanks to Cédric Dufour) has been included.
Continue reading