Category Archives: Spring

We’ve been using microservices in my workplace for a few years now, using a combination of Spring as our microservice framework and Redis as our cache layer, with Redis Sentinel helping to manage our high availability (i.e., HA). It’s worked well for us with our current master-slave configuration for HA, but we’ve always been curious about creating some load distribution among our Redis nodes, by redirecting some reads to the slaves. However, from what I’ve read in the past, it’s a bit tricky with the code to have both HA (through Sentinel) and I/O redirection. It seemed enough of an annoyance that it wasn’t really worth it. At least, until now!

In the next (i.e, Lovelace) release train of the Lettuce project, there will now be an optional way to create Redis connections with reads preferably directed to the slaves. And, if you still want to keep Redis Sentinel functionality, you just have to do the following:

Speaking of microservices, I still think that it would be a cool idea if Spring became more flexible with its configuration data. Like most Java applications, configuration data comes from the usual suspects: properties files in the Resources folder, environment variables, command-line options, etc. However, wouldn’t it be especially cool if configurations could come from dynamic sources, like database tables? And the services could change their configuration dynamically, by occasionally reading the configuration from the table? Sounds like an opportunity for MDD to make an entrance! But that’s a topic for another time.

So, after the last time with Redis, my team and I still felt uninformed about the features that Redis offers with its Enterprise version. And so, we were told that another session was coming up, one that would perhaps give us the answers we sought. Alas, that wasn’t really the case…but, hey, Redis definitely knows how to play the part of being a host. In my book, you get points for that.

This time, the event was held at Convene, which is uptown from Galvanize. In terms of accommodations, this hosting space was definitely one of the best that I’ve ever been to, especially in terms of food and a view:

And you have to appreciate any place that takes its coffee and yogurt seriously:

In the end, though, it seemed to be a similar presentation to the one a few months ago. We already knew about the HA functionality and regional synchronization that was available through the Enterprise version, but we were looking to possibly see it in action, along with the other bells and whistles. Oh well. Maybe next time…especially if it’s held again at Convene!

Not long ago, I was asked by some colleagues to help troubleshoot an issue; they were having some difficulty with the production deployment of a monolith web service using Wildfly and Spring. How could I resist, considering how much I love event-driven, IOC frameworks and their ridiculously verbose log files? (You can cut the sarcasm with a knife.) In any case, it seems that the server was failing during initialization. After wading through the gazillions of lines written due to an exception from the JedisConnectionFactory, I finally found an Null exception from our code that was a clue. It seemed to indicate that a variable was missing from from our active profile. So, I looked inside the standalone.xml file to see if we were pointing to the right profile:

That was the right profile name, all right…So I copied the deployed .WAR file and opened it up. Alas, the profile wasn’t inside the “/resources” directory! It seems that they weren’t deploying the right version. Problem solved.

So, that leads me to my point. Can the Spring community do me a big favor? If the target profile does not exist, then maybe the log file (among its gazillions of other lines) should say that THE TARGET PROFILE DOES NOT EXIST!