# Determine Core Allocation

The phrase "less is more" summarizes the best practices for EMS performance tuning.

- When the EMS server does not set thread affinity, the operating system can better schedule EMS server threads to react to changing workloads on the machine. Also examine if the application is making efficient use of the API before changing the default behavior. For example, when performing persistent messaging operations, consider using multiple threads in the applications (each with its own session) or consider using local transactions to batch sends and acknowledgments.
- Use the minimum number of threads to handle network traffic. Specifying a single thread may yield sufficient performance improvements over the default behavior, so start testing affinity there. Using excessive numbers of threads leads to greater thread contention for global data structures, which can reduce throughput and waste machine resources. Excessive numbers can also lead to more unbalanced connection assignments. TIBCO tests have shown that three (or four under some workloads) is the maximum useful number for network traffic.
- Specifying thread affinity to specific cores can provide the highest performance but can also lead to a configuration that does not react well to changing workloads. If you specify thread affinity for network traffic for persistent messaging, also set thread affinity for stores in order to prevent contention between threads handling those tasks.

Copyright © Cloud Software Group, Inc. All rights reserved.