Remove typechecker-only options from GlobalOptions to avoid code duplication
[hiphop-php.git] / hphp / doc / server.documents
blob7789f402f49acf4a61d22aa54cbcb87e8dc21202
2 <h2>Server Documents</h2>
4 This flow is implemented in hphp/runtime/server/http-server.cpp:
6                               +-------------+
7                               | APC Priming |
8                               +------+------+
9                                      |
10                                      V
11                             +-----------------+
12                             | StartupDocument |
13                             +--------+--------+
14                                      |
15                                      |
16                    +-----------------+
17                    |
18                    V
19     +============================+
20     |       Worker Thread        |
21     |____________________________|
22     |                            |
23     |  +-----------+             |
24     |  |           |             |
25     |  |           V             |
26     |  |   +----------------+    |
27     |  |   |  RequestInit   |    |
28     |  |   +----------------+    |
29     |  |           |             |
30     |  |           +----<-----+  |
31     |  |           V          |  |
32     |  |   +----------------+ R  |
33     |  |   |  URL Handling  | P  |
34     |  |   +----------------+ C  |
35     |  |           |          |  |
36     |  |           +---->-----+  |
37     |  |           |             |
38     |  +--(sweep)--+             |
39     |                            |
40     +============================+
43 1. StartupDocument
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.
61 4. RPCRequestHandler
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.