# Best practices for scaling integrations

There are a few architectural things to consider when you scale your system across hundreds or thousands of connections. Most commonly, we’ve seen roadblocks come up for: 

- mirroring data;
- multi-tenancy and dynamic onboarding; and
- volume management.

Explore our recommendations for handling each one below.

## Mirroring data

In almost any software architecture, mirroring data—or trying to maintain an in-sync duplicated representation of another system’s data—is an anti-pattern. It’s costly and difficult to maintain a duplicated dataset of another system.

Unfortunately, this anti-pattern is relatively common in healthcare integrations. That’s because your system might need to consume HL7 feeds from your connection’s system when no alternative is available. In these cases, your system must save data if you need to refer to it later, or on an ongoing basis.

If you can avoid it, we recommend not persisting a connection’s data. It’s costly in technology spend, maintenance, and operations, especially at scale. 

### Our recommendation

[Consider using data on demand](/basics/data-exchange-with-redox/data-on-demand) and designing your solution to access only the data you need when you need it. This option reduces your maintenance and operating costs while increasing your ability to scale rapidly.

## Multi-tenancy and dynamic onboarding

To scale from a few integrations to more than 100, it’s important to make onboarding new connections as dynamic and painless as possible.

Let’s say you want to exchange data with 100 connections. It takes one engineering day to provision new infrastructure for each integration. That means you’d lose 100 engineering days to onboard. That’s a huge opportunity cost when compared to the value 100 days of engineering effort could add to your product.

### Our recommendation

Consider implementing multi-tenancy on shared infrastructure and automated infrastructure partitioning. It’s tempting to provision segregated infrastructure for each integration, but this strategy is costly and quickly becomes unmaintainable at scale. Instead, choose a partitioning strategy that guarantees protection against data cross-contamination while also allowing for shared infrastructure and dynamic onboarding.

## Volume management

As your integrations scale up, your message volume naturally increases, especially if you have event-driven workflows. Event volume also varies widely across different healthcare organizations. 

### Our recommendation

Embrace event streaming architectural paradigms, which enable your architecture to scale. But keep these tips in mind:

- Make sure the layers of your architecture are horizontally and dynamically scalable, as well as tenant agnostic.
- Segregate tenant event streams, while keeping processing code as tenant agnostic as possible, to minimize the impact of high-volume event streams on other streams. 
- Isolate tenant-specific event streams so that problems in one tenant’s event stream don’t affect other tenants’ streams.
- Automate load balancing.
