2. About me
Senior Developer at PBSC
Professional experience: VoIP, cloud hosting, e-commerce, bike sharing
Editor at InfoQ.com, writing about .NET
Twitter: @plmaheu
4. The start of the journey
- “This page is too slow!”
- Some server is at maximum capacity
- Alerts fire by the dozen
- The system crashes, nobody knows why
5. What does “performance” means?
- Generic term, depends on how it is measured.
- Varies from system to system: latency, CPU usage, memory usage, memory
fragmentation, GPU usage, etc
- Performance in larger systems depends much more about how subsystems
interact with each other. (server with databases)
6. The method everybody knows: Guessing
- Tempting to optimize code out of a gut feeling
- Unlikely to get it right more than 5-10% of the time
- The possible causes are endless: code, third party library, web server, CDN,
DNS, bandwitdh, ISP, hardware, etc.
7. Ahmdal’s law
Regardless the magnitude of an improvement, the theoretical speedup of a task is
always limited by the part of the task that cannot benefit from the improvement.
TL;DR: Optimize the right thing.
8. Different issues at different scales.
In one second you can do:
- 1 file upload to a cloud storage provider
- 100 SQL queries
- 10,000 regex matches
- 10,000,000 property get through reflection
- 1,000,000,000 additions
10. Code profilers
- Variable level of detail, from a few chosen methods to *everything*
- Stacktrace with CPU usage
- External service calls
- Highlights hot spots in the stacktrace
- From light to heavy overhead, depending on detail resolution
14. Application Performance Monitoring
- Provides a high level view of performance on a system, usually web site or
service
- Always running, meant for production use
- Slight overhead, usually < 5% CPU
- Variable side features such as error logging
16. Takeaways
- Always measure before and after optimizing.
- Understand the root cause before changing something.
- Establish your goal(s) before an optimizing session.
- Get familiar with the tooling of your environnement.
Hinweis der Redaktion
Originally in the context of electrical engineers, applies well to software.
1s Upload a file to third party cloud service10ms to 100ms SQL Queries1ms Regex match0,001ms Get a property through reflection0,000,001ms Additions two numbers togetherA file upload may look slow, but a thousand SQL queries is slower.
Shows a detailed stack trace
Includes SQL queries, external calls
Especially suited when a central location drives the show (web server)
MiniProfiler,
Provides data directly from production, removes risk of difference between environnements.