YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Edge Caching - Developing Scalable Apps with Java

Get Embed Code
6 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  1. Another heavy-duty topic which is good to know about
  2. is edge caching. To describe this, let's look at
  3. the information flow for your App Engine application. First
  4. of all, users that want to use your application are
  5. connected to their internet service provider. This provider connects
  6. to Google data center. After the DNS lookup has
  7. determined that your application is hosted by Google, Google
  8. then identifies the data center where your App Engine application
  9. run, and starts talking to the App Engine front
  10. end. If the content is dynamic, the App Engine front
  11. end determines the instance that should manage the request.
  12. So these are your App Engine instances that run your
  13. application code. But if the request is for static
  14. content, for example images or static HTML, the front end
  15. can retrieve it directly from the static servers. And in
  16. both cases, the response is returned back to the user.
  17. So this is a good architecture. But as it looks
  18. right now, all the requests have to be sent to
  19. the data center, which hosts your App Engine application. It
  20. would be much better if more content could be served
  21. directly by this data center. First of all, it would
  22. ease the load on this data center, but more importantly,
  23. since it's closer to the users, the response would be
  24. delivered faster. This is exactly what edge caching is all about.
  25. Edge caching is a cache that sits in the
  26. data center closest to the user. So whenever there is
  27. a request, the result can be served directly from
  28. the cache if it's available there, rather than going through
  29. data center 2. That means less load on data
  30. center 2 in your application, and faster responses to your
  31. users. A win-win. So the question is, then, what
  32. do you need to think about to use edge caching?
  33. Well, there are two ways. The first one is
  34. to set the cache-control header, in the HTTP response. This
  35. should only be done if a subsequent request of this
  36. kind would return the same result. The second option is
  37. to define as much content as possible as static.
  38. Since static content does not change, it's great for edge
  39. caching. You can define which content is static through configuration
  40. files. A good opportunity for you to look at the
  41. online documentation. And remember, as most of the time
  42. with caching, there are no guarantees that the content will
  43. be cached, but when it is, it will be
  44. good for both your application as well as your users.