2 <h2>Server Documents</h2>
4 This flow is implemented in hphp/runtime/server/http-server.cpp:
19 +============================+
21 |____________________________|
26 | | +----------------+ |
28 | | +----------------+ |
32 | | +----------------+ R |
33 | | | URL Handling | P |
34 | | +----------------+ C |
40 +============================+
45 This file is executed when web server starts, and it is executed before any
46 thread gets started but after APC is primed. Example use:
48 * bootstrapping server
49 * preparing parameters for service threads (see below): in this case, we have
50 to use APC to pass those parameters into service threads.
52 2. This space intentionally left blank.
54 3. RequestInitDocument and RequestInitFunction
56 When a worker thread resets, the RequestInitDocument and/or RequestInitFunction
57 are executed in order to initialize certain states or request specific coding.
58 If both RequestInitDocument and RequestInitFunction are specified, the
59 RequestInitDocument is executed before the RequestInitFunction.
63 RPCRequestHandler will call ExecutionContext::backupSession() right after
64 RequestInit function/document, and it will call ExecutionContext::
65 restoreSession() right after it finishes one request processing and it goes
66 back to a state right after RequestInit is executed.
68 RPCRequestHandler will reset a worker thread from time to time, either after
69 the worker thread has processed a certain number of requests or after certain
70 amount of time. When this happens, it will perform a sweep and re-execute
71 RequestInit function/document.