This blog was running on WordPress on a dedicated Ubuntu 14.04 VM host. When I tried to update the host to Ubuntu 16.04, I broke WordPress. Rather than trying to figure out what went wrong, I decided to just run a new WordPress instance under Docker and move the blog to that. The transition wasn’t quite as easy as I’d hoped, so here are the steps (and missteps) I followed to finally get it to work. I first created a directory “blog” and two subdirectories “wp-content” and “db” on a docker host (an Ubuntu 16.04 VM) and brought up a new instance of the WordPress image from the official Docker repository (https://hub.docker.com/_/wordpress/) with the following docker-compose.yml file: I brought it[…]

We typically deploy REST APIs behind a HAProxy reverse proxy. We often need to enforce SLAs and protect those APIs from being flooded with too many concurrent requests. In this post, I’ll show you a straightforward way to do this with HAProxy’s max_conn setting. Furthermore, I’ll show you how you can quickly verify your rate-limiting strategy. We’ll create a simple test-bed consisting of two REST API instances fronted by a HAProxy instance and we’ll flood them with requests using the ab tool (Apache benchmark – which generates an arbitrary number of concurrent requests to an API). If a specific API gets too many concurrent requests, further requests will be rejected with a http 503 (service unavailable) and a message indicating[…]

After fooling around with other methods, we finally accepted the advice I got on the Wicket IRC channel and used Terracotta to cluster our Wicket-based apps running under Jetty. It turned out to be straightforward to implement. The first thing to do was to add the Terracotta dependencies to our pom.xml. [sourcecode language=”xml”] org.terracotta.session terracotta-session 1.1.1 org.terracotta terracotta-toolkit-1.1-runtime 2.0.0 [/sourcecode] Then you just need to add a Terracotta filter to the jetty WebAppContext as follows: [sourcecode language=”java”] FilterHolder tcFilterHolder = new FilterHolder(TerracottaJetty61xSessionFilter.class); tcFilterHolder.setInitParameter(“tcConfigUrl”, “terracotta:9510,terracotta2:9510”); context.addFilter(tcFilterHolder, “/*”, Handler.ALL); [/sourcecode] That’s it. Terracotta will cluster the session (in the example we’re using two terracotta servers called “terracotta” and “terracotta2” – a main server and a standby). We’re using a HAProxy load-balancer with[…]