-
Notifications
You must be signed in to change notification settings - Fork 1
/
multiplexer.en.html
219 lines (203 loc) · 10 KB
/
multiplexer.en.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Multiplexer — AMC Traffic Server Documentation</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '8.0.x',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Certifier" href="certifier.en.html" />
<link rel="prev" title="TSVConn Arguments" href="vconn-args.en.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="certifier.en.html" title="Certifier"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="vconn-args.en.html" title="TSVConn Arguments"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">SWOC Docs</a> »</li>
<li class="nav-item nav-item-1"><a href="ats-projects.en.html" accesskey="U">Traffic Server Projects</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/balcora-gate-400x400.jpg" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Multiplexer</a><ul>
<li><a class="reference internal" href="#description">Description</a></li>
<li><a class="reference internal" href="#implementation">Implementation</a><ul>
<li><a class="reference internal" href="#parsing-chunk-encoded-data">Parsing Chunk Encoded Data</a></li>
</ul>
</li>
<li><a class="reference internal" href="#notes">Notes</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="vconn-args.en.html"
title="previous chapter">TSVConn Arguments</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="certifier.en.html"
title="next chapter">Certifier</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/multiplexer.en.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="name">
<h1>Multiplexer<a class="headerlink" href="#name" title="Permalink to this headline">¶</a></h1>
<p>Multiplexer is a remap plug-in that allows a request to be multiplexed one or more times and sent to
different remap entries. Both headers and body (in case of POST or PUT methods, only) are copied
into the new requests.</p>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>Actions:</p>
<ol class="arabic simple">
<li>Adds <code class="docutils literal"><span class="pre">X-Multiplexer:</span> <span class="pre">original</span></code> header into client’s request.</li>
<li>Copies client’s request (bodies are copied by transforming the request)</li>
<li>Changes <code class="docutils literal"><span class="pre">Host</span></code> header of the copy according to <code class="docutils literal"><span class="pre">pparam</span></code> from the remap rule.</li>
<li>Changes <code class="docutils literal"><span class="pre">X-Multiplexer</span> <span class="pre">header</span></code> to “copy”.</li>
<li>Sends the copied request with <code class="code docutils literal"><span class="pre">TSHttpConnect</span></code>.</li>
</ol>
<p>Multiplexer dispatches the request in background without blocking the original request. Multiplexed
responses are drained and discarded.</p>
<p>A global timeout can be overwritten through <code class="docutils literal"><span class="pre">multiplexer__timeout</span></code> environment variable representing how many nanoseconds to wait. A default 1s timeout is hard-coded.</p>
<p>Please use <code class="docutils literal"><span class="pre">multiplexer</span></code> tag for debugging purposes. While debugging, multiplexed requests and
responses are printed into the logs.</p>
<p>Multiplexer produces the following statistics consumed with <code class="docutils literal"><span class="pre">traffic_ctl</span></code>:</p>
<ul class="simple">
<li>failures: number of failed multiplexed requests</li>
<li>hits: number of successful multiplexed requests</li>
<li>requests: total number of multiplexed requests</li>
<li>time(avg): average time taken between multiplexed requests and their responses</li>
<li>timeouts: number of multiplexed requests which timed-out</li>
<li>size(avg): average size of multiplexed responses</li>
</ul>
<p>Example remap.config:</p>
<div class="highlight-cpp"><div class="highlight"><pre><span></span><span class="n">map</span> <span class="nl">http</span><span class="p">:</span><span class="c1">//www.example.com/a http://www.example.com/ @plugin=multiplexer.so @pparam=host1.example.com</span>
<span class="n">map</span> <span class="nl">http</span><span class="p">:</span><span class="c1">//www.example.com/b http://www.example.com/ @plugin=multiplexer.so @pparam=host2.example.com</span>
<span class="n">map</span> <span class="nl">http</span><span class="p">:</span><span class="c1">//www.example.com/c http://www.example.com/ @plugin=multiplexer.so @pparam=host1.example.com @pparam=host2.example.com</span>
</pre></div>
</div>
</div>
<div class="section" id="implementation">
<h2>Implementation<a class="headerlink" href="#implementation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="parsing-chunk-encoded-data">
<h3>Parsing Chunk Encoded Data<a class="headerlink" href="#parsing-chunk-encoded-data" title="Permalink to this headline">¶</a></h3>
<p>Multiplexer parses chunked data with its own home brew parser. In the parser <code class="code docutils literal"><span class="pre">size_</span></code> is the size of
a chunk to be consumed. The local variable / parameter <code class="code docutils literal"><span class="pre">size</span></code> is raw input size as read from an
<code class="code docutils literal"><span class="pre">TSIOBufferBlock</span></code>. The “size states” are marked blue.</p>
<div class="figure align-center">
<p class="plantuml">
<object data="_images/plantuml-6458582619ff10545b8cd05d88310480a79e0bc7.svg" type="image/svg+xml" style="width:495px;height:894px;">
<img src="_images/plantuml-6458582619ff10545b8cd05d88310480a79e0bc7.png" alt="@startuml
skinparam state {
backgroundColor<<SIZE_STATE>> SkyBlue
}
state kSize <<SIZE_STATE>>
kSize : Accumulate size_\nfrom hex input.
[*] --> kSize
kSize --> kSize : hex digit
kSize --> kDataN : CR,size_ > 0
kSize --> kEndN : CR, size_ == 0
kSize --> kInvalid : *
state kDataN <<SIZE_STATE>>
kDataN --> kData : LF
kDataN --> kInvalid : *
kDataN : ASSERT(size_ > 0)
state kEndN <<SIZE_STATE>>
kEndN --> kEnd : LF
kEndN --> kInvalid : *
kData : Consume size_\nbytes of input.
kData --> kSizeR : Input consumed
state kSizeR <<SIZE_STATE>>
kSizeR --> kSizeN : CR
kSizeR --> kInvalid : *
state kSizeN <<SIZE_STATE>>
kSizeN --> kSize : LF
kSizeN --> kInvalid : *
kInvalid --> [*]
kEnd --> [*]
@enduml" />
</object></p>
</div>
</div>
</div>
<div class="section" id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This should be moved to the Traffic Server documentation.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="certifier.en.html" title="Certifier"
>next</a> |</li>
<li class="right" >
<a href="vconn-args.en.html" title="TSVConn Arguments"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">SWOC Docs</a> »</li>
<li class="nav-item nav-item-1"><a href="ats-projects.en.html" >Traffic Server Projects</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2017, [email protected].
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.6.
</div>
</body>
</html>