This preview shows page 449 - 451 out of 502 pages.
test engineer will set up several computers running httperfagainst the stagingsite and gradually increase the number of simulated users until some resourcebecomes the bottleneck. ELABORATION:Longevity bugs and rolling rebootStress testing can also expose bugs that only appear after a long time or underheavy load. A classic example is a resource leak: a long-running process eventuallyruns out of a resource, such as memory, because it cannot reclaim 100% of theunused resource due to either an application bug or the inherent design of a
language or framework. Software rejuvenationis a long-established way toalleviate a resource leak: the Apache web server runs a number of identical workerprocesses, and when a given worker process has “aged” enough, that process stopsaccepting requests and dies, to be replaced by a fresh worker. Since only one worker(1∕n of total capacity) is “rejuvenated” at a time, this process is sometimes calledrolling reboot, and most PaaS platforms employ some variant of it. Anotherexample is running out of session storage when sessions are stored in a databasetable, which is why Rails’ default behavior is to serialize each user’s session objectinto a cookie stored at the user’s browser, although this limits each user’s sessionobject to 4KiB in size. Summary:As with testing, no single type of monitoring will alert you of all problems: usea combination of internal and external (end-to-end) monitoring. Hosted monitoring such as Pingdom and PaaS-integrated monitoring such asNew Relic greatly simplify monitoring compared to the early days of SaaS. Stress testing and longevity testing can reveal the bottlenecks in your SaaSapp and frequently expose bugs that would otherwise remain hidden. Self-Check 12.5.1. Which of the following key performance indicators (KPIs) wouldbe relevant for Application Performance Monitoring: CPU utilization of a particularcomputer; completion time of slow database queries; view rendering time of 5slowest views. Query completion times and view rendering times are relevant because theyhave a direct impact on responsiveness, which is generally a Key PerformanceIndicator tied to business value delivered to the customer. CPU utilization, whileuseful to know, does not directly tell us about the customer experience. The idea behind caching is simple: information that hasn’t changed since the lasttime it was requested can simply be regurgitated rather than recomputed. In SaaS,caching can help two kinds of computation. First, if information needed from thedatabase to complete an action hasn’t changed, we can avoid querying the databaseat all. Second, if the information underlying a particular view or view fragmenthasn’t changed, we can avoid re-rendering the view (recall that rendering is theprocess of transforming Haml with embedded Ruby code and variables into HTML).