Blog

    Mirth Connect Performance Tuning: Raising Messages per Hour Without Losing Order

    By GauravJuly 29, 20269 mins read
    On this page

    Mirth Connect performance tuning starts when a server that kept up last year falls behind: a new results feed, a document payload or a prune job lands on the same database, and messages per hour drop. The useful response is a measurement you can repeat, then one change, then the same measurement again.

    The guidance is for hospital CTOs, CIOs and digital health founders who have been handed a messages-per-hour target, and for their interface engineers. You get a way to read the rate, when threads help, how attachments and pruning affect the database, and what to record before each change.

    What does performance tuning mean for Mirth Connect?

    Performance tuning for Mirth Connect means changing one thing that affects how fast messages finish, then reading the same counter over a comparable window. The levers are processing threads, how large payloads are stored, and how fast the message database grows. Agnotic Technologies takes the rate from your readings, not from a product rating.

    Tune a Mirth Connect server with Agnotic

    Our Mirth Connect page covers channel work and the capacity reviews we do for hospital interface teams.

    Tuning starts from a complaint you can point at: a sender timing out, a queue that is older at the end of the day than at the start, or a database volume that fills during the week. Write the complaint down, with the channel name, before you change threads.

    Treat a slow interface as an availability problem, not a cosmetic one. A channel that accepts messages and then sits on them leaves the systems waiting on those messages without results, orders or registrations, even when the process itself is up.

    How do you read a messages-per-hour number?

    Read a messages-per-hour number as the change in one named counter divided by the hours between two readings. Say which counter you used. A received rate, a sent rate, a filtered rate and an error rate are four different statements, and only the sent rate says the destination got the message.

    How to read a Mirth Connect rate, by which counter moved
    CounterWhat a rise meansWhat it does not mean
    ReceivedThe channel accepted that many messages in the windowThat they were delivered
    FilteredThe channel chose not to send themThat they failed
    SentA destination took themThat every destination took them, if the channel has several
    ErroredProcessing or delivery failedThat the sender knows, unless the acknowledgment said so
    QueuedThey are waitingThat the rate is fine, even if the queue age is climbing

    Take the readings from the same channel, on a clock you trust. If the counter drops, the process was restarted or the counter was cleared, and the window starts over. Do not average a window that includes a restart with a window that does not, and then call the result the afternoon rate.

    Compare the channel with itself: same counter, same kind of hour, this week against last week. Write the counter name, both readings, both times and the channel on one line, and divide the difference by the elapsed hours. Label any window that includes a restart, a prune, a backup or a deploy. A figure copied from another hospital is not your capacity, and a product limit quoted without your messages and your database is not one either.

    When should processing stay on one thread?

    Keep processing on one thread when this destination must see messages in the order they happened, or when the channel's scripts assume only one message is inside them at a time. Order is a clinical requirement more often than a technical preference: a later update that overtakes an earlier one leaves the downstream system wrong.

    NextGen Healthcare's Mirth Connect 3.4 release notes describe raising the maximum number of threads a channel can process at once, and say this is most useful for interfaces where message order across multiple sources does not matter.

    NextGen Healthcare describes the higher thread count as most useful where order across sources does not matter. If you cannot say that sentence about this channel, leave the thread count at the product default and put your effort into the slow destination, the queue, or the database. Raising threads on an ordered feed is how you buy speed and lose sequence.

    When is a higher thread count worth a trial?

    A higher thread count is worth a trial when messages are independent, the destination can accept more than one at a time, and a single slow message is blocking others that have nothing to do with it. Change the source processing thread count, then read the same counter over a comparable window.

    • Independent messages: one result does not have to precede another patient's result.
    • A destination that allows concurrent calls, confirmed by that system's owner, not assumed.
    • A before-and-after reading of sent per hour and of error count. If errors rise, put the thread count back.
    • One change only. A thread change made in the same hour as a prune or a code deploy cannot be interpreted.

    Destination queue threads are a different knob from source processing threads. Extra queue threads help when several destinations are slow for different reasons. They hurt when one destination required order and you gave it several consumers. Record which setting you changed, on which connector.

    How do attachments affect the database?

    Attachments keep a large payload stored once, instead of copying those bytes into every stored version of the message. Use the source attachment handling for documents and images. Leave ordinary HL7 segments inline.

    NextGen Healthcare's Mirth Connect issue record states that message attachments are stored in their own database table and, from the 3.4 change, are pruned together with message content.

    A channel that stores a full document inside the message body will grow the content tables by the size of that document on every copy the engine keeps. Moving the payload to an attachment does not make it free. It puts the bytes in the attachment table, which is still the database, and it gives you a single object to prune with the content. If the record policy says the document must be kept for years, the interface database is the wrong cupboard for it. Keep the long-term copy in the system that owns the document, and keep a short-lived copy in the engine only as long as delivery needs it.

    After you turn attachment handling on, send one large sample. Fix any later step that still expects those bytes inline before you enable the change on the live feed.

    Why does the message database grow?

    The message database grows because every accepted message leaves rows: content, metadata, and attachments when you use them. Growth follows how many messages you keep, how large each one is, and how long you keep it.

    NextGen Healthcare's Mirth Connect wiki states that message history is stored in the database and identifies that database as a performance bottleneck.

    Read growth as disk used per day, next to the received count. A quiet rate with large payloads fills a volume faster than a busy rate of short messages. Pruning and filtering address the count. Attachment handling addresses the size.

    • Content rows: the message body, raw and transformed, for the source and for each destination.
    • Metadata rows: status, timestamps and errors. They outlast content if you prune content first.
    • Attachment rows: the large payload, pruned with content from the 3.4 change onward.
    • Channels that store every message forever: the table that will page you on a weekend.

    How should you prune without stalling live traffic?

    Prune in small passes, at a time when you can watch the database, and stop the pass if message processing stalls. A prune deletes rows while channels are trying to insert new ones. A single enormous delete holds locks that the live feed needs.

    Run one prune job, with a bounded amount of work per pass, and watch whether the sent rate drops while it runs.

    • Prune content you are allowed to drop. The retention rule comes from the hospital's record policy, not from how full the disk is.
    • Watch sent rate and database locks during the first prune after you change the settings.
    • If processing stalls, make the next pass smaller. Do not raise it because the disk is urgent. A stalled feed is the worse outage.
    • Confirm attachments went away with the content, by looking at the attachment table for that channel after a test prune.

    What do you record before you change a setting?

    Before you change a setting, record the counter, the window, the error count, whether any destination needs order, the database size, and whether a prune or backup was running. Those six lines are what make the next reading mean something.

    • Channel name and the setting you intend to change, including its current value.
    • Received, sent and errored over the comparison window, with start and end times.
    • Oldest queued message age, per destination.
    • A yes or no on message order for each destination.
    • Database size today, and database size seven days ago if you have it.
    • Anything else that happened in the window: deploy, prune, backup, sender downtime.

    Change one value. Read the same lines again after a comparable window. Keep the change when the sent rate improved and the error count stayed flat. Put the setting back when you cannot tell those two things apart.

    Which destination is actually slow?

    Compare the oldest queued message age per destination, not per channel. One receiver answering slowly can hold down a channel's sent count while its other destinations sit idle.

    How does slow processing inside the channel show up?

    Received keeps pace, sent lags, and the destination queues stay short. That pattern points at time spent inside the channel rather than at a receiver, so time one sample through each step on a test server.

    When is tuning the wrong fix?

    When the queue grows because a destination is down, or because a sender is replaying its own backlog after an outage. Neither is a capacity problem.

    What are the common mistakes with Mirth Connect performance tuning?

    • Quoting a received rate as if it were a sent rate, so the server looks faster than the destinations do.
    • Raising the thread count on a feed whose destination needs messages in order.
    • Changing threads, pruning and a code deploy in the same window, so no reading can be explained.
    • Running one large prune during the busiest hour and stalling the live feed it was meant to protect.
    • Keeping years of documents in the interface database instead of in the system that owns them.

    How do you plan for a new feed on a busy server?

    Ask the sender for their own volume and payload size, run a sample batch on a test server, and read database growth per day before the feed goes live.

    How can Agnotic help tune a Mirth Connect server?

    Agnotic reads the counters with your team, names which rate you are actually talking about, and trials one change at a time: threads, attachments or pruning. We write down the before and after, and we put a setting back when the error count says we should.

    Review a slow Mirth Connect channel

    We measure the counter you care about, then change one setting and measure it again.

    Sources

    Frequently Asked Questions

    Hospital CTOs, CIOs and digital health founders who have been asked for a messages-per-hour target, and the interface engineers who will change the settings. The plan also needs the database owner, because growth and pruning sit on their side.

    Talk to an engineer about your project

    Tell us which channel is falling behind and which counter you have been watching. We will say whether the next change is threads, attachments or the database.