The CAP theorem remains one of the most important tools in my software developer's toolbelt. Used correctly, it can help create services and products that can offer an excellent user experience and protect revenue during partial failures. Used incorrectly, it can lead to a poor user experience and loss of revenue. Throughout this article, I look to explain the unexpected latency of specific transactions in MySQL, a CP system.
Despite the fact I've been developing software in one way or another for almost 20 years, I'm constantly surprised how things work, and, once the frustration wears off, I'm intrigued when things break. Lucky for me, over the last few weeks, I've been surprised, frustrated, and intrigued by what, on the surface, seems like a very trivial problem: MySQL reporting deadlocks in unexpected places and unexplainable slow query log entries when using optimistic concurrency control.
The "test-and-test-and-set" algorithm is a fairly well-understood solution to reducing latency in spin locks. In particular, the algorithm is often employed to reduce the latency exhibited in the similar "test-and-set" algorithm. Understanding how and why a seeming-superfluous read results in lower latency is rather interesting.
ConcurrentHashMap is an excellent point of study when learning about Java's Memory Model. It employs numerous
techniques to provide lock-free reads while still guaranteeing safe publication of objects. This article represents my
attempt to take the magic out of the
I recently discovered the convenience of the django-pipeline library when attempting to reduce the asset size of a Django project. Currently, this library only seems to support external CSS compressors, such as Yuglify and YUI. While I have no objection to these specific tools, I simply do not want to complicate the deployment strategy by depending on additional external applications.
While investigating a production bug that indicated that the operating system of a server running only a JVM continually
ran out of memory under a specific set of circumstances, I discovered a very interesting idiosyncrasy of the JVM.
Specifically, memory allocated with
mmap through the
MappedByteBuffer (the super class of
munmapped until the allocating
MappedByteBuffer is garbage collected.
Dropwizard's testing package includes a
DropwizardAppRule, that may be used to create end-to-end integration tests. However, you may rapidly discover that parallel test execution is severely impaired, as each test attempts to use the same application and admin ports as another.
The CDI specifications is very clear in its definition of qualifiers. Of particular importance is the
@Retention information: with the default retention,
CLASS, a container's behaviour is undefined.
Lately, I've been working with code that exhibits a fairly poor practice: programmatic transactions (namely Spring) don't always get committed or rolled-back, even though the code appears correct.
An annoying discovery: Java
Enum objects have non-deterministic hash codes. Specifically, a hash code is the
identity (or memory address).
The JDK provides several concurrent
Set classes, each with their own application, but it does not provide a
ConcurrentHashSet. Using the
Collections utility class, however, such a structure may be created.