Skip to content

Commit 8ad37d8

Browse files
committed
Documented js_fetch_keepalive_* directives.
1 parent 3cdfaee commit 8ad37d8

File tree

2 files changed

+179
-2
lines changed

2 files changed

+179
-2
lines changed

xml/en/docs/http/ngx_http_js_module.xml

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<module name="Module ngx_http_js_module"
1010
link="/en/docs/http/ngx_http_js_module.html"
1111
lang="en"
12-
rev="54">
12+
rev="55">
1313

1414
<section id="summary">
1515

@@ -473,6 +473,96 @@ with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
473473
</directive>
474474

475475

476+
<directive name="js_fetch_keepalive">
477+
<syntax><value>connections</value></syntax>
478+
<default>0</default>
479+
<context>http</context>
480+
<context>server</context>
481+
<context>location</context>
482+
483+
<para>
484+
Activates the cache for connections to destination servers.
485+
When the value is greater than <literal>0</literal>,
486+
enables keepalive connections for
487+
<link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
488+
</para>
489+
490+
<para>
491+
The <value>connections</value> parameter sets the maximum number of idle
492+
keepalive connections to destination servers that are preserved in the cache
493+
of each worker process.
494+
When this number is exceeded, the least recently used connections are closed.
495+
</para>
496+
497+
<para>
498+
Example:
499+
<example>
500+
location /fetch {
501+
js_fetch_keepalive 32;
502+
js_fetch_trusted_certificate /path/to/ISRG_Root_X1.pem;
503+
js_content main.fetch_handler;
504+
}
505+
</example>
506+
</para>
507+
508+
</directive>
509+
510+
511+
<directive name="js_fetch_keepalive_requests">
512+
<syntax><value>number</value></syntax>
513+
<default>1000</default>
514+
<context>http</context>
515+
<context>server</context>
516+
<context>location</context>
517+
518+
<para>
519+
Sets the maximum number of requests that can be served through one keepalive
520+
connection with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
521+
After the maximum number of requests is made, the connection is closed.
522+
</para>
523+
524+
<para>
525+
Closing connections periodically is necessary to free per-connection memory
526+
allocations.
527+
Therefore, using too high maximum number of requests could result in
528+
excessive memory usage and not recommended.
529+
</para>
530+
531+
</directive>
532+
533+
534+
<directive name="js_fetch_keepalive_time">
535+
<syntax><value>time</value></syntax>
536+
<default>1h</default>
537+
<context>http</context>
538+
<context>server</context>
539+
<context>location</context>
540+
541+
<para>
542+
Limits the maximum time during which requests can be processed through one
543+
keepalive connection with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
544+
After this time is reached, the connection is closed following the subsequent
545+
request processing.
546+
</para>
547+
548+
</directive>
549+
550+
551+
<directive name="js_fetch_keepalive_timeout">
552+
<syntax><value>time</value></syntax>
553+
<default>60s</default>
554+
<context>http</context>
555+
<context>server</context>
556+
<context>location</context>
557+
558+
<para>
559+
Sets a timeout during which an idle keepalive connection to a destination server
560+
will stay open with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
561+
</para>
562+
563+
</directive>
564+
565+
476566
<directive name="js_header_filter">
477567
<syntax><value>module.function</value></syntax>
478568
<default/>

xml/en/docs/stream/ngx_stream_js_module.xml

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<module name="Module ngx_stream_js_module"
1010
link="/en/docs/stream/ngx_stream_js_module.html"
1111
lang="en"
12-
rev="50">
12+
rev="51">
1313

1414
<section id="summary">
1515

@@ -347,6 +347,93 @@ with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
347347
</directive>
348348

349349

350+
<directive name="js_fetch_keepalive">
351+
<syntax><value>connections</value></syntax>
352+
<default>0</default>
353+
<context>stream</context>
354+
<context>server</context>
355+
356+
<para>
357+
Activates the cache for connections to destination servers.
358+
When the value is greater than <literal>0</literal>,
359+
enables keepalive connections for
360+
<link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
361+
</para>
362+
363+
<para>
364+
The <value>connections</value> parameter sets the maximum number of idle
365+
keepalive connections to destination servers that are preserved in the cache
366+
of each worker process.
367+
When this number is exceeded, the least recently used connections are closed.
368+
</para>
369+
370+
<para>
371+
Example:
372+
<example>
373+
server {
374+
listen 12345;
375+
js_fetch_keepalive 32;
376+
js_fetch_trusted_certificate /path/to/ISRG_Root_X1.pem;
377+
js_preread main.fetch_handler;
378+
}
379+
</example>
380+
</para>
381+
382+
</directive>
383+
384+
385+
<directive name="js_fetch_keepalive_requests">
386+
<syntax><value>number</value></syntax>
387+
<default>1000</default>
388+
<context>stream</context>
389+
<context>server</context>
390+
391+
<para>
392+
Sets the maximum number of requests that can be served through one keepalive
393+
connection with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
394+
After the maximum number of requests is made, the connection is closed.
395+
</para>
396+
397+
<para>
398+
Closing connections periodically is necessary to free per-connection memory
399+
allocations.
400+
Therefore, using too high maximum number of requests could result in
401+
excessive memory usage and not recommended.
402+
</para>
403+
404+
</directive>
405+
406+
407+
<directive name="js_fetch_keepalive_time">
408+
<syntax><value>time</value></syntax>
409+
<default>1h</default>
410+
<context>stream</context>
411+
<context>server</context>
412+
413+
<para>
414+
Limits the maximum time during which requests can be processed through one
415+
keepalive connection with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
416+
After this time is reached, the connection is closed following the subsequent
417+
request processing.
418+
</para>
419+
420+
</directive>
421+
422+
423+
<directive name="js_fetch_keepalive_timeout">
424+
<syntax><value>time</value></syntax>
425+
<default>60s</default>
426+
<context>stream</context>
427+
<context>server</context>
428+
429+
<para>
430+
Sets a timeout during which an idle keepalive connection to a destination server
431+
will stay open with <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>.
432+
</para>
433+
434+
</directive>
435+
436+
350437
<directive name="js_filter">
351438
<syntax><value>module.function</value></syntax>
352439
<default/>

0 commit comments

Comments
 (0)