How design can impact the size of your production topology
The design of your solution and how it stores and processes events can have a significant impact on the size of an Insight Server topology.
The size of a topology refers to the number of nodes in the cluster and the amount of computer memory that is needed to run your solution on Insight Server. The size of the topology can be adjusted in a number of ways, for example you can add runtime servers, add CPUs, and specify how runtime memory is stored. If a system is incorrectly sized, it can stop as a result of insufficient memory or insufficient CPU.
The following sections explain what you can do in the design phase to improve your solution performance and help you to limit the size of your final production topology.
Events
- Inbound event rate
- A high inbound event rate can impact performance. The higher the inbound event rate, the more CPU you are likely to need.
- Outbound event rate
- A high outbound event rate can also impact performance. The higher the outbound event rate, the more CPU you are likely to need.
- Event size
- Look at the data that is contained in the incoming events, and determine whether all of the data is needed for your solution. If an event type contains data that is not needed, then reduce the event size, or use transformation to reduce the size.
- Event transformation
- Transformation of events can result in a reduction of throughput.
Entities
- Hot entities
The processing of events with a specific entity ID is single threaded to avoid conflicting entity updates. A single thread means that the processing of a significant workload by a single entity can create a bottleneck. Throughput can fall significantly for a single entity ID as the event history grows.
For more information, see Event distribution.
- Size of entities
- The larger the size of the entities, the more memory is needed by the runtime servers.
- Number of entities
- The higher the number of entities in your solution, the more memory is needed by the runtime servers.
Agents
- Size of event history
Agents keep references to the events that they need. Each agent has a maxHorizon property, which keeps the events for this time period. During the event processing, an event is added to the event history for the bound entity. Because retaining events can have a significant impact on capacity, the maxHorizon property sets an ultimate limit on event retention. Design your model to get to a situation where the average history size per agent instance is in the range of a few hundred.
Set time horizons for your rule agents carefully to avoid large memory requirements. Review the horizon requirement for each rule agent. If a rule agent does not require event history, add with a horizon of 0 seconds to the agent descriptor. For the events that need a long horizon in an agent, ensure that the agent descriptor includes a horizon for each event type it processes.
To reduce the number of events that are processed and stored, you can offload events by creating specific event types that detect the more interesting cases. For example, a large transaction event or a duplicate transaction event can be emitted by an agent that processes a transaction event. The agents that process the emitted events can have a longer event history because these event types are less frequent. You can also use Java agents that do not use event history and generally use less memory than rule agents.
Tip: At run time, the eventCacheDuration property can be used to reduce the overall memory requirements for a solution. When eventCacheDuration is set, events are removed from memory after that time, and reloaded from the backing database as required. If eventCacheDuration is set to half the length of the horizon, it might reduce the overall memory requirements by more than a third. The more events per entity, the more dramatic the reduction. If you have many entities, which are used infrequently, eventCacheDuration can be reduced to small times, like 1 minute.- Number of agents
Prefer multiple rules within a single agent rather than multiple agents bound to the same entity. Each agent requires extra memory and processing, so minimizing the number of agents can improve performance.
- Types of rules within agents
- Rules that schedule delayed processing can have an impact on performance.
- Event filtering
If certain events are not of interest, filter the events in the agent descriptor.
‘MyAgent1' is an agent related to a customer , processing events : - purchase when the amount is more than 100, where this customer comes from the customerid of this purchaseIf an event can be filtered out by logic in the descriptor, it is discarded by the gateway client or connectivity server.
- Aggregation
Consider the use of shared aggregates instead of keeping many events in memory for each agent. If possible, use the resolution parameter of a shared aggregate to reduce the memory footprint further.
For more information, see Shared aggregates.
When you use global event aggregates, write rules that have no reference to time, or use during the current minute/hour/day instead of during the last period of x minutes/hours/days. Global event aggregates that use during the current minute/hour/day are optimized so that the query does not need to store all the events, and so require less memory and have better performance.
Connectivity
Choice of inbound/outbound protocol (JMS/HTTP). Performance can also be affected by the choice of JMS provider and message persistence.