1

Problem:

Our REST API is for requests for static images and requests for other computationally intensive tasks, such as rendering new images.

We noticed that our Apache-Django server gets bogged down on some rendering requests, and thus is unable to fulfill the more frequent and simple static image requests.

Basic outline of a solution:

Server 1 parses the URL requests and decides whether if the request is a static image request for passing to Server 2 or rendering request for passing to Server 3.

Server 2 and Server 3 then send the response back to the client.

We use AWS.

Questions:

Should Apache-Django be used for all servers above?

Should CloudFront be considered an alternative for Server 2?

Can Server 1 be handled by somehow extending AWS Load Balancer?

What more should I research?

Wesley
  • 32,320
  • 9
  • 80
  • 116
b_dev
  • 201
  • 1
  • 3
  • 6

1 Answers1

1

CloudFront isn't going to buy you much if every request has to hit your server first. However, CloudFront recently gained support for dynamic content, so you could setup your service based on this.

CloudFront would be the entry point for all incoming requests. Static content would be stored on S3 (with appropriate Expires headers), and CloudFront configured to serve static content from S3. Dynamic content would be served from your EC2 instances (with immediate Expires headers) and CloudFront configured to serve dynamic content from these servers.

mgorven
  • 30,036
  • 7
  • 76
  • 121
  • Can you please elaborate on this statement: "CloudFront isn't going to buy you much if every request has to hit your server first."? – b_dev May 18 '12 at 17:11
  • The whole point of CloudFront is to serve and cache your content closer to the clients. If every request has to go through a server (or set of servers) in a single location then it's not going to improve performance. – mgorven May 18 '12 at 17:35
  • So to conclude, using the CloudFront framework, I could have some specified set of URL requests, which are only for static images, go to S3 buckets of the images, and all the rest of the requests be re-routed to our regular EC2 server. Correct? – b_dev May 18 '12 at 17:43
  • Yes, that is correct. – mgorven May 18 '12 at 17:47