Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
net_instaweb::RateController Class Reference

#include "rate_controller.h"

Public Member Functions

 RateController (int max_global_queue_size, int per_host_outgoing_request_threshold, int per_host_queued_request_threshold, ThreadSystem *thread_system, Statistics *statistics)
 
void ShutDown ()
 Makes any further fetches quick-fail.
 
bool is_shut_down () const
 
void Fetch (UrlAsyncFetcher *fetcher, const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
 

Static Public Member Functions

static void InitStats (Statistics *statistics)
 Initializes statistics variables associated with this class.
 

Static Public Attributes

static const char kQueuedFetchCount []
 
static const char kDroppedFetchCount []
 
static const char kCurrentGlobalFetchQueueSize []
 

Friends

class CustomFetch
 

Detailed Description

Controller which limits the number of outgoing fetches per domain. If the fetch is for a user-facing request, this sends the request out anyway and updates the count for number of outgoing fetches. For non-user facing requests, this checks that the number of outgoing fetches for this domain is less than the limit. If less than the limit, it sends the fetch out and updates the count. If greater than the per-domain limit, and if the global queue size is within the limit, it queues the request up. However, if the global queue size is above the limit, it drops the request. If a request is dropped, the response will have HttpAttributes::kXPsaLoadShed set on the response headers.

Note: this requires working statistics to work.

Member Function Documentation

void net_instaweb::RateController::Fetch ( UrlAsyncFetcher fetcher,
const GoogleString url,
MessageHandler message_handler,
AsyncFetch fetch 
)

Applies our shaping policies, and either (eventually) asks fetcher to fetch the given URL or drops it.


The documentation for this class was generated from the following file: