Closed bschoenfeld closed 9 years ago
I thought of and implemented a different solution. Searching an individual court is done with an individual request. The search page makes tons of AJAX calls, but they are throttled to happen 1 second apart. This allows multiple users to use a single server at the same time. It also keeps users from hitting the court servers so hard. The complete search takes a little longer, but its still much faster and easier and manually searching each court.
It takes 2 - 3 minutes to search all the courts. We are currently streaming the contents of the search, rendering the template court by court. It's responsive, but it ties up the server connection for a while. To ensure, we don't lose requests, we are using a number of Heroku dynos, which is expensive.
A better solution could be to use background tasks. One web server could handle all requests. Searches could be queued and handled by one or two background task runners. Searches could take a few more minutes during peak usage, but the site would be cheaper to run.