Skip to content

Commit 62a0b69

Browse files
committed
updated docs to reflect recent changes.
1 parent b128981 commit 62a0b69

File tree

3 files changed

+96
-33
lines changed

3 files changed

+96
-33
lines changed

README

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -180,27 +180,57 @@ Synopsis
180180
}
181181

182182
Description
183-
This module embeds Lua, via the standard Lua interpreter or LuaJIT, into
184-
Nginx and by leveraging Nginx's subrequests, allows the integration of
185-
the powerful Lua threads (Lua coroutines) into the Nginx event model.
183+
This module embeds Lua, via the standard Lua interpreter or LuaJIT 2.0
184+
(<http://luajit.org/luajit.html>), into Nginx and by leveraging Nginx's
185+
subrequests, allows the integration of the powerful Lua threads (Lua
186+
coroutines) into the Nginx event model.
186187

187188
Unlike Apache's mod_lua
188189
(<http://httpd.apache.org/docs/2.3/mod/mod_lua.html>) and Lighttpd's
189190
mod_magnet (<http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet>), Lua
190191
code executed using this module can be *100% non-blocking* on network
191192
traffic as long as the Nginx API for Lua provided by this module is used
192-
to handle requests to upstream services such as mysql, postgresql,
193-
memcached, redis, or upstream http web services. (See
194-
ngx.location.capture, ngx.location.capture_multi, ngx.socket.tcp,
195-
[[HttpDrizzleModule]], ngx_postgres
196-
(<http://github.com/FRiCKLE/ngx_postgres/>), [[HttpMemcModule]],
197-
[[HttpRedis2Module]] and [[HttpProxyModule]] modules for details).
193+
to handle requests to upstream services such as MySQL, PostgreSQL,
194+
Memcached, Redis, or upstream HTTP web services.
195+
196+
At least the following Lua libraries and Nginx modules can be used with
197+
this ngx_lua module:
198+
199+
* lua-resty-memcached
200+
(<https://github.com/agentzh/lua-resty-memcached>)
201+
202+
* lua-resty-mysql (<https://github.com/agentzh/lua-resty-mysql>)
203+
204+
* lua-resty-redis (<https://github.com/agentzh/lua-resty-redis>)
205+
206+
* lua-resty-dns (<https://github.com/agentzh/lua-resty-dns>)
207+
208+
* lua-resty-upload (<https://github.com/agentzh/lua-resty-upload>)
209+
210+
* ngx_memc
211+
212+
* ngx_postgres (<https://github.com/FRiCKLE/ngx_postgres>)
213+
214+
* ngx_redis2
215+
216+
* ngx_redis
217+
218+
* ngx_proxy
219+
220+
* ngx_fastcgi
221+
222+
Almost all the Nginx modules can be used with this ngx_lua module by
223+
means of ngx.location.capture or ngx.location.capture_multi but it is
224+
recommended to use those "lua-resty-*" libraries instead of creating
225+
subrequests to access the Nginx upstream modules because the former is
226+
usually much more flexible and memory-efficient.
198227

199228
The Lua interpreter or LuaJIT instance is shared across all the requests
200229
in a single nginx worker process but request contexts are segregated
201-
using lightweight Lua coroutines. Loaded Lua modules persist in the
202-
nginx worker process level resulting in a small memory footprint even
203-
when under heavy loads.
230+
using lightweight Lua coroutines.
231+
232+
Loaded Lua modules persist in the nginx worker process level resulting
233+
in a small memory footprint in Lua even when under heavy loads.
204234

205235
Directives
206236
lua_code_cache
@@ -4776,21 +4806,20 @@ Data Sharing within an Nginx Worker
47764806
processes under an Nginx master, data sharing cannot cross the process
47774807
boundary between these workers.
47784808

4779-
If server wide data sharing is required:
4809+
If server-wide data sharing is required, then use one or more of the
4810+
following approaches:
47804811

47814812
1. Use the ngx.shared.DICT API provided by this module.
47824813

4783-
2. Use only a single nginx worker and a single server. This is however
4814+
2. Use only a single nginx worker and a single server (this is however
47844815
not recommended when there is a multi core CPU or multiple CPUs in a
4785-
single machine.
4816+
single machine).
47864817

47874818
3. Use data storage mechanisms such as "memcached", "redis", "MySQL" or
47884819
"PostgreSQL". The ngx_openresty bundle (<http://openresty.org>)
47894820
associated with this module comes with a set of companion Nginx
4790-
modules that provide interfaces with these data storage mechanisms.
4791-
See the [[HttpMemcModule]], [[HttpRedis2Module]],
4792-
[[HttpDrizzleModule]] and HttpPostgresModule
4793-
(<http://github.com/FRiCKLE/ngx_postgres/>) modules for details
4821+
modules and Lua libraries that provide interfaces with these data
4822+
storage mechanisms.
47944823

47954824
Known Issues
47964825
TCP socket connect operation issues

README.markdown

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,30 @@ Synopsis
193193
Description
194194
===========
195195

196-
This module embeds Lua, via the standard Lua interpreter or LuaJIT, into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model.
196+
This module embeds Lua, via the standard Lua interpreter or [LuaJIT 2.0](http://luajit.org/luajit.html), into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model.
197197

198198
Unlike [Apache's mod_lua](http://httpd.apache.org/docs/2.3/mod/mod_lua.html) and [Lighttpd's mod_magnet](http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet), Lua code executed using this module can be *100% non-blocking* on network traffic as long as the [Nginx API for Lua](http://wiki.nginx.org/HttpLuaModule#Nginx_API_for_Lua) provided by this module is used to handle
199-
requests to upstream services such as mysql, postgresql, memcached, redis, or upstream http web services. (See [ngx.location.capture](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture), [ngx.location.capture_multi](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture_multi), [ngx.socket.tcp](http://wiki.nginx.org/HttpLuaModule#ngx.socket.tcp), [HttpDrizzleModule](http://wiki.nginx.org/HttpDrizzleModule), [ngx_postgres](http://github.com/FRiCKLE/ngx_postgres/), [HttpMemcModule](http://wiki.nginx.org/HttpMemcModule), [HttpRedis2Module](http://wiki.nginx.org/HttpRedis2Module) and [HttpProxyModule](http://wiki.nginx.org/HttpProxyModule) modules for details).
199+
requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services.
200200

201-
The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
202-
Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint even when under heavy loads.
201+
At least the following Lua libraries and Nginx modules can be used with this ngx_lua module:
202+
203+
* [lua-resty-memcached](https://github.com/agentzh/lua-resty-memcached)
204+
* [lua-resty-mysql](https://github.com/agentzh/lua-resty-mysql)
205+
* [lua-resty-redis](https://github.com/agentzh/lua-resty-redis)
206+
* [lua-resty-dns](https://github.com/agentzh/lua-resty-dns)
207+
* [lua-resty-upload](https://github.com/agentzh/lua-resty-upload)
208+
* [ngx_memc](http://wiki.nginx.org/HttpMemcModule)
209+
* [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres)
210+
* [ngx_redis2](http://wiki.nginx.org/HttpRedis2Module)
211+
* [ngx_redis](http://wiki.nginx.org/HttpRedisModule)
212+
* [ngx_proxy](http://wiki.nginx.org/HttpProxyModule)
213+
* [ngx_fastcgi](http://wiki.nginx.org/HttpFastcgiModule)
214+
215+
Almost all the Nginx modules can be used with this ngx_lua module by means of [ngx.location.capture](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture) or [ngx.location.capture_multi](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture_multi) but it is recommended to use those `lua-resty-*` libraries instead of creating subrequests to access the Nginx upstream modules because the former is usually much more flexible and memory-efficient.
216+
217+
The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
218+
219+
Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads.
203220

204221
Directives
205222
==========
@@ -4287,10 +4304,10 @@ This data sharing technique is essential for high performance Lua applications b
42874304

42884305
Note that this data sharing is on a *per-worker* basis and not on a ''per-server' basis'. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers.
42894306

4290-
If server wide data sharing is required:
4307+
If server-wide data sharing is required, then use one or more of the following approaches:
42914308
1. Use the [ngx.shared.DICT](http://wiki.nginx.org/HttpLuaModule#ngx.shared.DICT) API provided by this module.
4292-
1. Use only a single nginx worker and a single server. This is however not recommended when there is a multi core CPU or multiple CPUs in a single machine.
4293-
1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The ngx_openresty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules that provide interfaces with these data storage mechanisms. See the [HttpMemcModule](http://wiki.nginx.org/HttpMemcModule), [HttpRedis2Module](http://wiki.nginx.org/HttpRedis2Module), [HttpDrizzleModule](http://wiki.nginx.org/HttpDrizzleModule) and [HttpPostgresModule](http://github.com/FRiCKLE/ngx_postgres/) modules for details
4309+
1. Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine).
4310+
1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The ngx_openresty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms.
42944311

42954312
Known Issues
42964313
============

doc/HttpLuaModule.wiki

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,30 @@ This document describes ngx_lua [https://github.com/chaoslawful/lua-nginx-module
183183

184184
= Description =
185185

186-
This module embeds Lua, via the standard Lua interpreter or LuaJIT, into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model.
186+
This module embeds Lua, via the standard Lua interpreter or [http://luajit.org/luajit.html LuaJIT 2.0], into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model.
187187

188188
Unlike [http://httpd.apache.org/docs/2.3/mod/mod_lua.html Apache's mod_lua] and [http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet Lighttpd's mod_magnet], Lua code executed using this module can be ''100% non-blocking'' on network traffic as long as the [[#Nginx API for Lua|Nginx API for Lua]] provided by this module is used to handle
189-
requests to upstream services such as mysql, postgresql, memcached, redis, or upstream http web services. (See [[#ngx.location.capture|ngx.location.capture]], [[#ngx.location.capture_multi|ngx.location.capture_multi]], [[#ngx.socket.tcp|ngx.socket.tcp]], [[HttpDrizzleModule]], [http://github.com/FRiCKLE/ngx_postgres/ ngx_postgres], [[HttpMemcModule]], [[HttpRedis2Module]] and [[HttpProxyModule]] modules for details).
189+
requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services.
190190

191-
The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
192-
Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint even when under heavy loads.
191+
At least the following Lua libraries and Nginx modules can be used with this ngx_lua module:
192+
193+
* [https://github.com/agentzh/lua-resty-memcached lua-resty-memcached]
194+
* [https://github.com/agentzh/lua-resty-mysql lua-resty-mysql]
195+
* [https://github.com/agentzh/lua-resty-redis lua-resty-redis]
196+
* [https://github.com/agentzh/lua-resty-dns lua-resty-dns]
197+
* [https://github.com/agentzh/lua-resty-upload lua-resty-upload]
198+
* [[HttpMemcModule|ngx_memc]]
199+
* [https://github.com/FRiCKLE/ngx_postgres ngx_postgres]
200+
* [[HttpRedis2Module|ngx_redis2]]
201+
* [[HttpRedisModule|ngx_redis]]
202+
* [[HttpProxyModule|ngx_proxy]]
203+
* [[HttpFastcgiModule|ngx_fastcgi]]
204+
205+
Almost all the Nginx modules can be used with this ngx_lua module by means of [[#ngx.location.capture|ngx.location.capture]] or [[#ngx.location.capture_multi|ngx.location.capture_multi]] but it is recommended to use those <code>lua-resty-*</code> libraries instead of creating subrequests to access the Nginx upstream modules because the former is usually much more flexible and memory-efficient.
206+
207+
The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
208+
209+
Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads.
193210

194211
= Directives =
195212

@@ -4136,10 +4153,10 @@ This data sharing technique is essential for high performance Lua applications b
41364153
41374154
Note that this data sharing is on a ''per-worker'' basis and not on a ''per-server' basis'. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers.
41384155
4139-
If server wide data sharing is required:
4156+
If server-wide data sharing is required, then use one or more of the following approaches:
41404157
# Use the [[#ngx.shared.DICT|ngx.shared.DICT]] API provided by this module.
4141-
# Use only a single nginx worker and a single server. This is however not recommended when there is a multi core CPU or multiple CPUs in a single machine.
4142-
# Use data storage mechanisms such as <code>memcached</code>, <code>redis</code>, <code>MySQL</code> or <code>PostgreSQL</code>. [http://openresty.org The ngx_openresty bundle] associated with this module comes with a set of companion Nginx modules that provide interfaces with these data storage mechanisms. See the [[HttpMemcModule]], [[HttpRedis2Module]], [[HttpDrizzleModule]] and [http://github.com/FRiCKLE/ngx_postgres/ HttpPostgresModule] modules for details
4158+
# Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine).
4159+
# Use data storage mechanisms such as <code>memcached</code>, <code>redis</code>, <code>MySQL</code> or <code>PostgreSQL</code>. [http://openresty.org The ngx_openresty bundle] associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms.
41434160
41444161
= Known Issues =
41454162

0 commit comments

Comments
 (0)