How to Implement an ESB Layer Correctly on the First Attempt

Where to start and how to implement an Enterprise Service Bus (ESB) correctly: architectural approaches, rollout stages, common mistakes, and integration tips

  • A Bit of Context
  • First mistake: building the bus architecture on the model of direct integration
  • What is the mistake
  • How it should have been done

What this article is about

The article was published in IT-world. Reading time: 7 min. Published on: 11.5.2023.

Implementing an enterprise service bus (ESB, short

from the English enterprise service bus) is a challenging task even for integrators who have deployed dozens of similar solutions.

You need to determine which architecture fits a specific project, find an efficient way to transfer data, and understand how to implement services inside the bus. In 2022, the KT.Team team learned firsthand that if you do not follow processes and do not ask yourself and the client the right questions during analysis, even straightforward integrations can be implemented incorrectly.

We launched the first version of the bus for a startup quickly, then rebuilt it twice. Here is why that happened, what we learned, and how to avoid our mistakes.

A Bit of Context

  1. Last year, KT.Team implemented a service bus for the ATIMO startup, which built an app for automatically obtaining route sheets for drivers. ATIMO works with taxi fleets and vehicle fleets that do not want to keep a mechanic and a medic on staff.

  2. These companies use automated checkpoints for vehicle inspections and driver health checks. At these checkpoints, a technician and a doctor perform inspections and upload the results to the ATIMO system for processing.

  3. The taxi fleet sends driver and vehicle information to ATIMO and receives a completed trip sheet in the app in return.

  4. While there were only two taxi fleets, each was connected directly to the system, but future scaling made ATIMO reconsider the architecture of its IT solution.

  5. At this stage, ATIMO reached out to KT.Team.

  6. They needed a service bus, software that flexibly integrates different systems.

  7. The bus was meant to handle data exchange between the taxi fleet, technical and medical inspection points, and the ATIMO databases without overloading the server.

First mistake: what was done in ESB 1.0

The bus architecture was built on the same principle as a direct connection: they created a service that queried each database in turn every 20 minutes.

Do not do this: an architecture with one service for all connections

This architecture had one major advantage: it required almost 10 times fewer server resources.

If with a direct connection each request consumed up to 4

GB of memory, then in ESB 1.0 about 500 MB were spent on a single request.

What was wrong with ESB 1.0

  1. At the start of implementation, only two taxi fleets needed to be connected to the bus, so the KT.Team team chose a fairly simple approach. ESB 1.0 ran for six months, during which new taxi fleets began being connected to the ATIMO system.

  2. When their number grew to 10, it became clear that the bus was completely not fault tolerant.

  3. The problems were caused by an initially incorrect bus architecture: the more databases connected to it, the higher the risk of failure.

  4. The databases were queried sequentially, and if one did not respond or dropped the connection, the bus stopped working. In other words, if a failure occurred when connecting to the very first taxi fleet, all the other taxi fleets were also left without waybills.

  5. In addition, a message broker was used to transfer information into ESB 1.0.

  6. The bus forwarded data between the taxi fleet and the ATIMO system as is, without processing it in any way.

  7. The exchange was not always correct, and part of the message could be lost.

How it should have been done instead of ESB 1.0

  1. Using separate services for each connection will make the architecture less coupled: a failure in one database will not affect data exchange with the others.

  2. This architecture will be more fault tolerant.

  3. To make data transfer more stable, it is better to use internal storage, the bus's own databases.

  4. The bus will receive data from the taxi fleets' databases and from ATIMO, then store it internally.

  5. That way, data transfer will work faster and more reliably.

Second mistake: what was done in ESB 2.0

  1. The KT.Team planned to use several data collection services in ESB 2.0 instead of one and two internal databases instead of a message broker. In the end, they implemented an intermediate solution: they kept one service for all taxi fleets, but completely changed the data exchange logic.

  2. The message broker was replaced with databases: one for vehicle and driver information, and another for completed trip sheets. The bus then pulled data on demand from these databases into the ATIMO system or to the taxi fleet.

  3. This decision was made for two reasons. First, the new bus version required more resources, since all taxi fleets had to be processed at the same time rather than one by one. Second, the customer prioritized rapid implementation of changes, while a full architecture redesign would have taken some time.

  4. ATIMO also asked for more frequent polling of the taxi fleets, with new data loaded every minute.

  5. The project team also met this requirement: technically, the bus can run even faster. However, the taxi fleets' databases could no longer handle that speed.

  6. For one especially slow database, we had to artificially limit the number of requests, because it treated minute-by-minute connections as a DDoS attack and blocked the bus.

  7. The update was implemented, and ATIMO immediately noticed the improvement.

  8. The bus operated without failures, and there were practically no support requests.

  9. The solution turned out to be memory-efficient and stable enough.

Assess where AI can deliver impact in your process

What was wrong with ESB 2.0

  1. At first glance, everything looked great: ESB 2.0 ran stably, and new taxi fleets were successfully connected to it. After about a month, there were already

  2. The problem was that the ESB architecture remained incorrect: one service sequentially queried all 15 databases.

  3. At the same time, the ATIMO system kept growing, and it was clear that sooner or later the bus would start failing again.

  4. The mistake in this version was that the project team focused on saving server resources and reducing development time.

  5. The key architectural problem of ESB 1.0 remained in ESB 2.0, so the bus had to be refined again.

How it should have been done instead of ESB 2.0

  1. For an ESB to be truly fault tolerant, it needs the right architecture.

  2. The best approach in this situation is to discuss realistic development timelines with the client.

  3. A full redesign takes time, but it also delivers a scalable and reliable data bus.

  4. The KT.Team team already knew what needed to be changed, so it did not wait for a request from ATIMO or for an ESB failure and redesigned the bus on its own initiative.

Final ESB 3.0: what we built

  1. In ESB 3.0, we implemented the architecture we had abandoned in the previous version, with separate services for each database.

  2. All services work the same way: they connect to the taxi fleet database, download data from it, convert it to the format used by the ATIMO system (mapping rules were set up for this), write new data to the store, and remove outdated data.

  3. Use the right architecture: one service for each connection.

  4. Such a bus is resilient to failures in individual databases.

  5. To keep the services from consuming too many server resources, they were made as simple as possible: all unnecessary and resource-intensive steps, such as exception logging, were removed.

  6. Instead, the data in the store is overwritten on every successful connection to the taxi fleet's database.

  7. Polling one taxi fleet now requires about 300 MB of memory, instead of 4 GB at the start of the project.

  8. The final version of the service bus was rolled out shortly before 2023 began.

  9. After that, KT.Team did not receive a single technical support request until the end of January. And ATIMO's first question was not about the reliability of the service bus at all.

  10. The thing is, ESB 3.0 has a useful feature: a new connection point for a taxi fleet can be created by simply cloning any existing one.

  11. Then you need to set a few parameters, and the ESB will be able to retrieve the required data.

  12. This solution made the bus scalable, so ATIMO does not need to contact support to add a taxi fleet.

  13. The KT.Team team created a step-by-step guide to make the process clearer.

  14. The first question from ATIMO was about that step, because the description of one of the steps was not entirely clear.

  15. We answered the question, adjusted the text, and now adding a new taxi fleet takes only a couple of hours instead of several days as before.

What the result was

  1. "ATIMO" successfully integrates new taxi fleets with ESB 3.0 without KT.Team's help.

  2. In the first 3.5 months of 2023, the startup team added 10 new integrations on their own using the documentation.

  3. There are already 20 taxi fleets in the system, and the number of databases from which the bus pulls driver and vehicle information is twice as high.

  4. ATIMO's limited server resources are used sparingly: one request uses only 300 MB of memory instead of 4 GB with a direct connection.

  5. Consumption was reduced thanks to a very simple service design that queries the taxi fleet database. The support chat is quiet: the bus performs its functions, and the occasional questions are related to minor local issues on the side of individual databases.

  6. Most often, the issue resolves itself: the taxi fleet fixes its side of the process, and the ATIMO system receives updated data. In this case, the KT.Team team gained valuable experience and refined the ESB implementation process.

  7. It is important to account for future growth and possible points of failure in the system from the start by implementing it properly.

  8. So the best approach is to implement such a bus through separate services for each connection, even if there are only two for now.

How Long Implementation Takes

Our typical time estimates are based on the condition that the architecture is designed before development begins, not during it.

StageDurationResult
Pre-projectFrom 30 working hours to 2-3 weeksRequirements, analysis of the current architecture, tool selection, architecture design
DevelopmentAbout 40 developer hours per flowEntity mapping, the most complex flow as a template for the rest
Documentation25-30 hoursInstructions that support follows instead of the developer

On average, implementing an ESB layer takes about 1.5-2 months until MVP launch, excluding the pre-project phase. The most time-consuming parts are the pre-project analysis and the most complex flow; how thoroughly the first is worked out directly determines whether the second will need to be reworked.

Discuss the article: How to implement an ESB layer correctly from the first...

Send via: