Techniques for traffic surge protection of live origin server
One embodiment of a method for responding to requests for media content includes receiving a first request from a first client for at least one segment of a media content item, retrieving, from a datastore, a reference to each segment included in the at least one segment, retrieving, from a cache, the at least one segment of the media content item based on the reference to each segment included in the at least one segment, and transmitting the at least one segment of the media content item to the first client.
1 . A computer-implemented method for responding to requests for media content, the method comprising:
receiving a first request from a first client for at least one segment of a media content item; and
in response to the first request:
retrieving, from a datastore, a reference to each segment included in the at least one segment;
retrieving, from a cache, the at least one segment of the media content item based on the reference to each segment included in the at least one segment; and
transmitting the at least one segment of the media content item to the first client.
2 . The computer-implemented method of claim 1 , wherein the first request is associated with a first priority, and the method further comprises:
receiving a second request from a second client, wherein the second request is associated with a second priority that is lower than the first priority; and
in response to determining that a load on the datastore is greater than a threshold, dropping the second request based on the second priority.
3 . The computer-implemented method of claim 2 , wherein the threshold is based on a predefined percentage of requests being processed by the datastore at a reduced speed.
4 . The computer-implemented method of claim 2 , further comprising determining that the load on the datastore is greater than the threshold based on a signal from the datastore.
5 . The computer-implemented method of claim 1 , further comprising determining the first request is associated with a first priority based on the at least one segment being within a predefined window of time from a live stream of the media content item.
6 . The computer-implemented method of claim 1 , further comprising:
receiving one or more segments of the media content item;
generating metadata indicating one or more versions of the one or more segments;
storing the metadata in the datastore; and
storing the one or more segments of the media content item in the cache and in the datastore.
7 . The computer-implemented method of claim 1 , wherein the first request is associated with a first priority, and the first priority is lower than a second priority associated with requests to write data to the datastore.
8 . The computer-implemented method of claim 1 , wherein the first request is associated with a first priority, and the first priority is lower than a second priority associated with requests for manifest information indicating at least one of one or more versions or one or more segments of one or more media content items.
9 . The computer-implemented method of claim 1 , wherein the first request is forwarded by a server device of a content distribution network (CDN) that does not store the at least one segment of the media content item.
10 . The computer-implemented method of claim 1 , wherein the cache comprises at least one of one or more memories or one or more ephemeral disks.
11 . One or more non-transitory computer-readable media storing instructions that, when executed by at least one processor, cause the at least one processor to perform steps comprising:
receiving a first request from a first client for at least one segment of a media content item; and
in response to the first request:
retrieving, from a datastore, a reference to each segment included in the at least one segment;
retrieving, from a cache, the at least one segment of the media content item based on the reference to each segment included in the at least one segment; and
transmitting the at least one segment of the media content item to the first client.
12 . The one or more non-transitory computer-readable media of claim 11 , wherein the first request is associated with a first priority, and the steps further comprise:
receiving a second request from a second client, wherein the second request is associated with a second priority that is lower than the first priority; and
in response to determining that a load on the datastore is greater than a threshold, dropping the second request based on the second priority.
13 . The one or more non-transitory computer-readable media of claim 12 , wherein the threshold is based on a predefined percentage of requests being processed by the datastore at a reduced speed.
14 . The one or more non-transitory computer-readable media of claim 12 , wherein the instructions, when executed by the at least one processor, further cause the at least one processor to perform the step of determining that the load on the datastore is greater than the threshold based on a signal from the datastore.
15 . The one or more non-transitory computer-readable media of claim 12 , wherein the instructions, when executed by the at least one processor, further cause the at least one processor to perform the step of determining the second request is associated with the second priority based on the at least one segment of the media content item that is specified in the second request not being within a predefined window of time from a live stream of the media content item.
16 . The one or more non-transitory computer-readable media of claim 11 , wherein the instructions, when executed by the at least one processor, further cause the at least one processor to perform the steps of:
receiving one or more segments of the media content item;
generating metadata indicating one or more versions of the one or more segments;
storing the metadata in the datastore; and
storing the one or more segments of the media content item in the cache and in the datastore.
17 . The one or more non-transitory computer-readable media of claim 11 , wherein the first request is associated with a first priority, and the first priority is lower than a second priority associated with requests to write at least one of media content item segments or manifest information to the datastore.
18 . The one or more non-transitory computer-readable media of claim 11 , wherein the first request is associated with a first priority, and the first priority is lower than a second priority associated with requests for manifest information indicating at least one of one or more versions or one or more segments of one or more media content items.
19 . The one or more non-transitory computer-readable media of claim 11 , wherein the cache is associated with a higher throughput than the datastore.
20 . A system, comprising:
a memory storing instructions; and
a processor that is coupled to the memory and, when executing the instructions, is configured to perform the steps of:
receiving a first request from a first client for at least one segment of a media content item, and
in response to the first request:
retrieving, from a datastore, a reference to each segment included in the at least one segment,
retrieving, from a cache, the at least one segment of the media content item based on the reference to each segment included in the at least one segment, and
transmitting the at least one segment of the media content item to the first client.