Application Metrics for Swift contains a web-based dashboard showing a range of metrics including HTTP requests, CPU and memory usage.
Adding monitoring to your application is very straightforward in most cases, requiring just a few lines added to your main Swift source file. See the Quick Start Guide for details.
After starting your application you can then navigate to <hostname>:<port>/swiftmetrics-dash in a browser (localhost:8080/swiftmetrics-dash is the default if running locally).
Understanding the data
Most of the data is plotted as line graphs. HTTP Incoming Requests shows request duration against time. HTTP Throughput shows requests per second. Average Response Times (top 5) shows the 5 incoming HTTP requests that took the longest on average. CPU and Memory graphs show system and process usage over time.
The HTTP Incoming Requests graph has points. Hovering over one of these points with the mouse will show the response time and the requested url.
A maximum of 15 minutes of data is shown across all graphs.
If a lot of HTTP requests are coming in to the application being monitoring then the dashboard will automatically start to aggregate data. Each point on the HTTP Incoming Requests chart will represent all the requests for a 2 second period. The tooltip shows the total number of requests along with the average time taken and the longest time. The longest time is the value actually plotted.
The Application Metrics Dashboard can help you to identify common performance problems such as:
- Slow HTTP response times on some or all routes
- Lower than expected throughput in the application
- Spikes in demand causing slowdown
- Higher than expected CPU usage for the level of throughput/load
- High and/or growing memory usage (potential memory leak)