Scrooge is a cache-centric framework for asynchronous web applications.
h2. Project goals
- All client requests are served out of Amazon's S3 and can be handled with or without a running backend server.
A web page consists of two components: an HTML template and a optional JSON document.
There are there kinds of web pages:
- Completely static pages (just HTML)
- Semi-dynamic pages (template HTML + pre-compiled JSON data)
- Fully-dynamic pages (template HTML + dynamically generated JSON data)
Completly static web pages are supported by just retrieving a template from S3.
Semi-dynamic web pages require AJAX:
- The browser loads the blank template.
- An ajax call retrieves the appropreate JSON document from S3.
Fully-dynamic page get interesting:
- The browser loads the blank template
- An ajax call from the client checks whether s3://results/my_data.json exists
- If it does not, the client PUTS a blank JSON document to s3://results/my_data_hash.json and a JSON document with the query parameters to s3://requests/my_data_hash.json
- The client now polls S3 and waits for data to be added to s3://results/my_data_hash.json
- The server polls s3://requests/ looking for new requests
- It PUTS the results to s3://results/my_data.json
- It DELETES s3://requests/my_data.json
- The client now retrieves the completed JSON and renders the template, like a semi-dynamic page.
h2. Worker process
Workers are responsible for consuming from the submission queue and populating the cache
- Polls github gist for requests
- Processes request (business logic)
- Posts results to s3://data/#####.json