SCPR/calif-earthquakes — pull request #59 by chrislkeller (2014-04-03 17:50:13+00:00)
Title: Refactor and overhaul of application views and json endpoints

* Tests and bulletproofs caching of the views to close #55.
* Cleans up names of cache keys.
* Streamlines database queries to perform complicated filtering in application memory sted of separate db calls to close #56.
* Adjusts url endpoint to populate backbone-powered interactive map.

Results of load testing below

**Test 1 - Ramp to 200 users, adding 2 users per second**

* Pages tested:
* index page
* detail page
* json api that powers index page map
* json api that powers detail page map

* Notes:
* Tested current production branch to 300 total requests
* Failures on current production branch started at 170 users and less than 200 total requests.
* Tested refactored development branch to 2000 total requests
* Zero failures

**Test 2 - Ramp to 2000 users, adding 2 users per second**

* Pages tested:
* index page
* detail page
* json api that powers index page map
* json api that powers detail page map

* Notes:
* Failures on current production branch started at 160 users and less than 500 total requests and stopped test on current production branch at 460 users and a 65% failure rate.
* Tested refactored development branch to 1620 users and 60,000 total requests before a failure.
* Stopped it at 1,825 users and 75,500 total requests.
* Ramped up refactored development branch to 2096 users in 10 seconds and 3,000 or so requests and had three failures on the detail level page.

* Repeat failures
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: / (Caused by : [Errno 24] Too many open files)",),)
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: / (Caused by : [Errno 54] Connection reset by peer)",),)
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /api/earthquake?q=%7B%22order_by%22:[%7B%22field%22:%22date_time%22,%22direction%22:%22desc%22%7D]%7D (Caused by : [Errno 60] Operation timed out)",),)
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /api/earthquake?q=%7B%22order_by%22:[%7B%22field%22:%22date_time%22,%22direction%22:%22desc%22%7D]%7D (Caused by : [Errno 32] Broken pipe)",),)
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /api/earthquake/9377 (Caused by : [Errno 22] Invalid argument)",),)
* ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /aromas-march-18-2014/9377/ (Caused by : [Errno 60] Operation timed out)",)