1

I have an application that generates static pages. say roughly around 10 html pages/min. These pages are going to be served to users. On server side, I am using Django as development framework with Gunicorn to run my App server and I am using Nginx as 'Reverse Proxy'.

With this stack, I have few doubts regarding my design for Storing and Serving content. Also I am not sure, If my approach will cause any performance penalty which I am not able to guess now. So here are my thoughts on this:

Storage

I am thinking of a flat file based system to store content. Which will be stored according to timestamp so that I can clear/delete them up in future In case content is expired or it's not required. So path for a typical file will look like /var/www/project/content/timestamp/file/path.

I also checked Django Flatpages (app available in Django) which allows easy maintains of flatpages using admin panel and API. But this looks more promising for,

  • Fixed number of pages and (for me, it's huge and varying)
  • If you have any Editing requirement for the pages. (I don't need this)

Serving

For serving the content I am planing of exposing the '/var/www/content/' folder by Nginx so that it can be directly served by Nginx without any delay from app server. In case, I see any performance hit. I can use some static file caching Engine like Varnish.

Any suggestion or thought will be helpful. Thanks..

lalit
  • 3,283
  • 2
  • 19
  • 26
  • 1
    Use CDN or S3 to serve the static content.use style.css?version=1 style of urls to serve the newer versions of static files. – Srinivas Reddy Thatiparthy Feb 21 '13 at 15:47
  • @Darklord: Thanks for reply. As I commented on the answer below. In my case, I can't take advantage of CDN. Also once the content is generated it's not modified again so I am not worried about versioning. – lalit Feb 21 '13 at 17:51

1 Answers1

2

I would probably offload the responsibility of storing these static files to S3, and serve them via CloudFront.

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144
  • Hi Brandon, My content doesn't really take advantage of CDN. Most of the content is such that. It is served to people in fixed geographical location and a user does NOT access multiple content resource together. Besides this cost is my other important concern. Hence looking for a near optimal soluton that I can build. – lalit Feb 21 '13 at 17:44
  • 1
    Regardless of geographic area, you're going to be hard pressed to build a more scalable system that Amazon. I leverage S3/CloudFront for several freelance clients with high static content needs, and my bills are typically pennies a month. – Brandon Taylor Feb 21 '13 at 17:46
  • Hmm, Thanks I can probably give it a try. – lalit Feb 21 '13 at 18:03
  • I don't think you'll be disappointed. Check out django-storages: http://django-storages.readthedocs.org/en/latest/. It makes pushing content to S3 via an Image/FileField ridiculously easy. – Brandon Taylor Feb 21 '13 at 18:05