The APM Server is a separate component for the following reasons:
- It helps to keep the agents as light as possible and since the APM Server is a stateless separate component, it can be scaled independently.
- For Real User monitoring data is collected in browsers. APM Server prevents browsers from interacting directly with Elasticsearch (which poses a security risk) and controls the amount of data flowing into Elasticsearch.
- In cases where Elasticsearch becomes unresponsive, APM Server can buffer data temporarily without adding overhead to the agents.
- Provides a JSON API for agents to use thereby improving compatibility across different versions of agents and the Elastic Stack.