Programming Languages

Load balancing Red Hat JBoss Enterprise Application Platform subclusters with mod_cluster

Load balancing Red Hat JBoss Enterprise Application Platform subclusters with mod_cluster

This article introduces a way to build and manage clustered environments using subclusters in a domain-mode installation of Red Hat JBoss Enterprise Application Platform (JBoss EAP). I assume that readers are familiar with JBoss EAP and the Apache HTTP Server (HTTPD) mod_cluster module. I introduce the load balancing group configuration for that module.

Continue reading Load balancing Red Hat JBoss Enterprise Application Platform subclusters with mod_cluster

Share
Generate automated Grafana metrics dashboards for MicroProfile apps

Generate automated Grafana metrics dashboards for MicroProfile apps

Grafana is an awesome visualization tool for seeing real-time metrics from your applications, and you can combine it with MicroProfile and similar tools to create one dashboard for multiple projects. Different projects use different names for metrics, however, so it is often necessary (and tedious) to handcraft the metrics for each project. Moreover, each project can expose its own custom metrics, and each MicroProfile vendor can also produce custom metrics, so there are many manual steps involved if you want to see all of your metrics in one place.

What if you could simply examine a running app and generate a dashboard with all of its exposed metrics? That is exactly what you can do with the MicroProfile Metrics Generator, a new open source tool that I created to dynamically generate Grafana dashboards for any MicroProfile project by capturing and monitoring all of your project metrics. Once you’ve created a dashboard, you can use it with Grafana, customize it to suit specific needs, and save it as a JSON file. You can also periodically regenerate your dashboards to bring in new metrics that you’ve exposed in your application.

In this article, you will learn how to do just that: Use the MicroProfile Metrics Generator to create a unified dashboard for all of your project’s metrics.

Continue reading “Generate automated Grafana metrics dashboards for MicroProfile apps”

Share
Behavior is easy, state is hard: Tame inconsistent state in your Java code

Behavior is easy, state is hard: Tame inconsistent state in your Java code

DevNation Tech Talks are hosted by the Red Hat technologists who create our products. These sessions include real solutions plus code and sample projects to help you get started. In this talk, you’ll learn the root cause of common inconsistent state-related bugs in your production Java code—and how to solve them—from Edson Yanaga and Burr Sutter.

Continue reading Behavior is easy, state is hard: Tame inconsistent state in your Java code

Share
Improved XML grammar binding and more in Red Hat VS Code XML extension 0.13.0

Improved XML grammar binding and more in Red Hat VS Code XML extension 0.13.0

Following closely on the huge 0.12.0 update, the new Red Hat XML extension for Visual Studio Code (VS Code) 0.13.0 release makes XML editing in VS Code even better. For this release, we focused on making it easier to bind and generate a new XML Schema Definition (XSD) or Document Type Definition (DTD) grammar file from an existing XML file. Other highlights include document link support for xsi:schemaLocation, XML catalog snippets, support for XML catalog path validation, and support for DTD SystemId file path completion.

Continue reading Improved XML grammar binding and more in Red Hat VS Code XML extension 0.13.0

Share
Improve your code: Tales from confinement without a debugger

Improve your code: Tales from confinement without a debugger

I have always been impressed by developers who make do without a debugger, and have often wished I could be more like them. I vaguely recall a colleague saying he never used a debugger, favoring printf over gdb. Also, in my rookie years, I vividly recall chasing a kernel bug with a friend who was using objdump and the source of a much older kernel:

“Richard, shouldn’t you at least use the correct source?”
“Meh … they’re close enough.”

I’m still impressed.

Now that I have coded for some years, I’ve noticed that I have picked up some bad habits along the way. Over-dependence on the debugger is one of them. I often use it as a high-powered crutch, which frequently leads me waist-deep into stack traces, rarely stopping to think things through. I get lost inside 20 levels of recursion and wonder why an irrelevant variable is being tickled.

Granted, there are many good uses for a debugger, but I’m at 40% on the good use scale. My uses usually start benign but then degrade into cancerous abstractions. So, for my 20th GNU Compiler Collection (GCC) hacking anniversary, I decided to give myself the challenge of one month without a debugger. Here is the tale.

Continue reading “Improve your code: Tales from confinement without a debugger”

Share
Profile-guided optimization in Clang: Dealing with modified sources

Profile-guided optimization in Clang: Dealing with modified sources

Profile-guided optimization (PGO) is a now-common compiler technique for improving the compilation process. In PGO (sometimes pronounced “pogo”), an administrator uses the first version of the binary to collect a profile, through instrumentation or sampling, then uses that information to guide the compilation process.

Profile-guided optimization can help developers make better decisions, for instance, concerning inlining or block ordering. In some cases, it can also lead to using obsolete profile information to guide compilation. For reasons that I will explain, this feature can benefit large projects. It also puts the burden on the compiler implementation to detect and handle inconsistencies.

This article focuses on how the Clang compiler implements PGO, and specifically, how it instruments binaries. We will look at what happens when Clang instruments source code during the compilation step to collect profile information during execution. Then, I’ll introduce a real-world bug that demonstrates the pitfalls of the current approach to PGO.

Continue reading “Profile-guided optimization in Clang: Dealing with modified sources”

Share
A developer-centered approach to application development

A developer-centered approach to application development

Do you dream of a local development environment that’s easy to configure and works independently from the software layers that you are currently not working on? I do!

As a software engineer, I have suffered the pain of starting projects that were not easy to configure. Reading the technical documentation does not help when much of it is outdated, or even worse, missing many steps. I have lost hours of my life trying to understand why my local development environment was not working.

An ideal scenario

As a developer, you have to meet a few prerequisites before contributing to a project. For instance, you must agree to the version-control requirements, and you need to know how to use the project IDE, how to use a package manager, and so on.

But nothing more. You don’t need to learn a poorly documented, made-in-house framework just to satisfy the ego of an architect who wanted to reinvent the wheel. You don’t need to run an external virtual machine to emulate the production environment. As a developer, you are free to invest your time in improving the code and adding value to the product.

A developer-centered approach to application development

My goal with this article is to describe strategies for building an Angular 8 application in a way that centers the developer experience.

Continue reading “A developer-centered approach to application development”

Share
Build a simple cloud-native change data capture pipeline

Build a simple cloud-native change data capture pipeline

Change data capture (CDC) is a well-established software design pattern for a system that monitors and captures data changes so that other software can respond to those events. Using KafkaConnect, along with Debezium Connectors and the Apache Camel Kafka Connector, we can build a configuration-driven data pipeline to bridge traditional data stores and new event-driven architectures.

This article walks through a simple example.

Continue reading “Build a simple cloud-native change data capture pipeline”

Share
Improved schema binding and more in Red Hat XML extension for VS Code 0.12.0 and LemMinX

Improved schema binding and more in Red Hat XML extension for VS Code 0.12.0 and LemMinX

The latest update of the Red Hat XML extension for Visual Studio Code (VS Code), version 0.12.0, is packed with bug fixes and new features. It includes the new version of the underlying Eclipse LemMinX XML language server. In this update, we streamlined the process of writing XML Schema Definitions (XSD) and Document Type Definitions (DTD). We also added shortcuts to bind XML documents to either of these types of XML grammar.

Continue reading Improved schema binding and more in Red Hat XML extension for VS Code 0.12.0 and LemMinX

Share
Install Apache Tomcat and deploy a Java web application on Red Hat OpenShift

Install Apache Tomcat and deploy a Java web application on Red Hat OpenShift

If you are new to OpenShift, then you might want to install Apache Tomcat on top of it for simpler experimentation. This article guides you through installing Apache Tomcat from a Docker image and then using it to deploy a Java web app on Red Hat OpenShift. I also show you how to access the Tomcat management console on OpenShift.

To follow the examples, you must have an OpenShift account. We will use the OpenShift command-line interface (CLI) for this demonstration, so be sure to install the CLI (oc) before you begin.

A note about the sample application: You will need a Java web application to use for the deployment example. I am using the Sample Java Web Application from the OpenShift Demos GitHub repository. It is a simple application that is useful for understanding basic concepts. You may use the provided sample or choose your own application to work with.

Continue reading “Install Apache Tomcat and deploy a Java web application on Red Hat OpenShift”

Share