From: Daniel Gruno
-This document will discuss how you can bla bla bla.
-In the first chapter, we will bla bla
+This document will discuss several cases where
-In the second part of this document, we will be looking at bla bla bla
-
+Setting the right
+As a general rule of thumb: If your server has none to low usage, use
+Note: The
+By default,
+For maximum performance, it is generally recommended that any initialization of libraries,
+constants and master tables be kept outside the handle's scope:
+
@@ -814,28 +884,14 @@ print(unescaped) -- prints "This is a test"
-apache2.sendfile
- Â
-Returns the currently allowed overrides for this context (AuthCfg, Options etc)
-
-Arguments:
-
-Return value(s):
-
-Example:
- Â
-Returns the current Authorization realm
-
-Arguments:
-
-Return value(s):
- Â
-Returns the current authentication type used in the request
-
-Arguments:
-
-Return value(s):
- Â
-Flushes the content buffer, writing everything to the client immediately.
-
-Arguments:
-
-Example:
- Â once
, which means
+that every call to a Lua script will spawn a new Lua state that handles that
+script and is destroyed immediately after. This option keeps the memory
+footprint of mod_lua low, but also affects the processing speed of a request.
+If you have the memory to spare, you can set the scope to thread
,
+which will make mod_lua spawn a Lua state that lasts the entirity of a thread's
+lifetime, speeding up request processing by 2-3 times. Since mod_lua will create
+a state for each script, this may be an expensive move, memory-wise, so to
+compromise between speed and memory usage, you can choose the server
+option to create a pool of Lua states to be used. Each request for a Lua script or
+a hook function will then acquire a state from the pool and release it back when it's
+done using it, allowing you to still gain a significant performance increase, while
+keeping your memory footprint low. Some examples of possible settings are:
+once
+or request
, if your server has low to medium usage, use the server
+pool, and if it has high usage, use the thread
setting. As your server's
+load increases, so will the number of states being actively used, and having your scope
+set to once/request/conn
will stop being beneficial to your memory footprint.
+min
and max
settings for the
+server
scope denotes the minimum and maximum states to keep in a pool per
+server process, so keep this below your ThreadsPerChild
limit.
+forever
value, which will cause mod_lua
+to skip the stat process and always reuse the compiled byte-code from the first access to the
+script, thus speeding up the processing. For Lua hooks, this can prove to increase peformance,
+while for scripts handled by the lua-script
handler, the increase in performance
+may be negligible, as files httpd will stat the files regardless.
+
-apache2.port
-
-apache2.options
-
-apache2.allowoverrides
-
apache2.requestbody
apache2.add_input_filter
apache2.get_basic_auth_pw
-apache2.get_limit_req_body
-
-apache2.request_has_body
-
apache2.set_document_root
-apache2.some_auth_required
-
apache2.set_context_prefix
apache2.get_server_name_for_url
@@ -844,18 +900,8 @@ print(unescaped) -- prints "This is a test"
apache2.make_etag
-apache2.flush
-
apache2.send_interim_response
-apache2.get_server_name
-
-apache2.auth_type
-
-apache2.auth_name
-
-apache2.satisfies
-
-
-
-
-Argument
-Description
-
-
-r
-The mod_lua request handle
-
-The currently allowed overrides for this context (AuthCfg, Options etc)
-
-
-
-
-Argument
-Description
-
-
-r
-The mod_lua request handle
-
-The current authorization realm
-
-
-
-
-Argument
-Description
-
-
-r
-The mod_lua request handle
-
-The current Authorization type used in the request
-
-
-
-
-Argument
-Description
-
-
-r
-The mod_lua request handle
-
Â
--Returns the current request body size limit -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-The current request body size limit
-
-Example: -
-Â
--Returns the current server name from the request -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-The server name
-
-Example: -
-Â
-Â
-Returns the currently allowed options for this context (Indexes, MultiViews etc) -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-The currently allowed options for this context.
-
-Example: -
-Â
--Returns the port currently being used by the request -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-The current port used by the request
-
-Example: -
-Â
--Returns true if the request has a body(POST/PUT), false otherwise -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-True if the request has a body(POST/PUT), false otherwise
-
-Example: -
-Â
-Â
-Returns how the requires lines must be met. -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-How the requirements must be met (SATISFY_ANY, SATISFY_ALL, SATISFY_NOSPEC).
-
-Example: -
-Â
-Â
-Sends a file to the client via sendfile() if possible. -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
filename | -The file to send | -
-Example: -
-Â
-Â
-Returns true if authorization is required for this request -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-True if auth is required, false if not.
-
-Example: -
-Â
-
apache2.add_version_component
-apache2.banner
-
apache2.mpm_query
apache2.terminate
@@ -1715,14 +1352,8 @@ end
apache2.scoreboard_worker
-apache2.started
-
apache2.module_info
-apache2.get_server_built
-
-apache2.is_initial_req
-
apache2.loaded_modules
apache2.runtime_dir_relative
@@ -1771,25 +1402,6 @@ end
Â
Â
-Returns the date the server was built -
--Arguments: -
-None
-
-Return value(s):
-
-The date the server was built
-
Â
--Returns true if this is the main request, false if it is a sub-request -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-True if this is the main request, false if it is a sub-request
-
Â
-Â
-Returns the time when the server was (re)started -
--Arguments: -
-Argument | -Description | -
---|---|
r | -The mod_lua request handle | -
-Return value(s):
-
-The time when the server was (re)started
-
Â
-Â