Previous | Next --- Slide 19 of 54
Back to Lecture Thumbnails

I'm still a little bit confused about what a service exactly is, is it another process or thread that is added to the work queue (or spawned) to accomplish its specified task?


@maxdecmeridius I will make the example clearer by pointing out a real example on Facebook (previous FB intern here):

While Facebook is rendering, it has many independent general components, including: News Feed, Trending Panel, Recommended Friends/Pages, and Ads Sidebar. Also, within News Feed, each post is independent of each other; within Ads Sidebar, different ads are also independent. Therefore, Facebook uses asynchronous scheduling to render the page, i.e. to render different "general parts" of the page in parallel. The actual logic looks like the following:


  • accept incoming request

  • render basic page skeleton, meanwhile:

  • asynchronously gather posts for News Feed

    • asynchronously load entries on News Feed
  • asynchronously load Recommendations

  • asynchronously load Trending Panel

  • asynchronously load Ads

    • asynchronously find appropriate ads and pull them from database
  • as soon as a panel finishes loading, show it on the page ```

As you can see, there is a huge amount of parallelism even when rendering one single page. And, this smart "asynchronous" library really achieved a huge speedup for page rendering.


The compareprime in assignment 4 is a good example for this slide (inter-request parallelism).