Re: [Discuss] mod_lua and database connectivity

2013-01-03 Thread zhiguo zhao
Maybe you need this: https://github.com/zhaozg/mod_luaex
Example on http://kkhub.com



2013/1/4 Brian McCallister bri...@skife.org

 Supporting luasql would be a big bonus, though I understand if goal is to
 provide a quick and dirty api which is backed by mod_dbd

 http://www.keplerproject.org/luasql/manual.html

 -Brian


 On Thu, Jan 3, 2013 at 4:57 PM, Brian McCallister bri...@skife.orgwrote:

 On Thu, Jan 3, 2013 at 5:32 AM, Daniel Gruno rum...@cord.dk wrote:

 -
 Connecting to a database:
 -
 function handler(r)
 local db, error = r:dbopen(mod_dbd) -- Open a mod_dbd connection


 Shouldn't this be a method on the server representation, not the request
 representation?


 if error then ... end
 -- or...
 local db, error = r:dbopen(mysql,
 server=localhost,user=root,database=somedb)
 -- essentially the same as mod_dbd's connection string.
 do_stuff()
 db:close() -- close the db handle (can also be done by GC)


 Hmm, if db here represents a handle, it should prolly be paired with
 acquire not open.


 local still_running = db:active() -- returns false, since we closed
   -- the connection.
 end

 -
 Querying:
 -
 -- Run a command and get the no. of rows affected:
 local affected, err = db:do(r, DELETE FROM `table` WHERE 1)
 if err then
 print(DB error:  .. err)
 else
 print(Deleted  .. affected ..  rows!)
 end

 -- Run a query and get the rows returned:
 local rows, err = db:query(r, SELECT `name` FROM `table` WHERE 1)


 Check your errors :-)

 Also, be careful what you return, you don't want to the API to force you
 to realize all results from a query eagerly.


 if rows then
 r:puts(We got  .. #rows  ..  results!)
 for k, row in pairs(rows) do
 print(Name:  .. row[1] .. br/)
 end
 else
 r:puts(DB error:  .. err)
 end

 -- Run a prepared statement and inject values into it:
 local rows, err = db:inject(r, SELECT `name` FROM `tbl` WHERE `id` =
 %u, 1234)



 Hmm, I would expect an API like

 local pstmt, err = h:prepare(...)
 ... = pstmt:execute(hello, 7)
 -- or ... = pstmt:query(hello, 7)

 or such style api. Injecting into implicit prepared statement is a
 strange api.


 if rows then
 
 else
 
 end


 --
 Miscellaneous:
 --

 -- escaping strings for use in db queries:
 local escaped = db:escape(r, [[foobar'|baz]])


 So, any comments, suggestions, remarks, objections and so on is very
 much welcomed. If there are no big objections to implementing this
 feature, I will consider it as lazy consensus and commit the bindings to
 trunk sometime soon along with updated documentation.

 With regards,
 Daniel.

 PS: I _have_ checked and double checked the code properly this time, so
 it conforms to the style requirements and works with maintainer mode. I
 know I usually get something wrong, but this time I think it's as close
 to perfect as it can get :) (but then again, I always write something
 bad, so apologies in advance if you find a bug)






Re: Additional core functions for mod_lua

2012-08-07 Thread zhiguo zhao
  I write a mod_luaex[ https://github.com/zhaozg/mod_luaex ]  to extends
mod_lua, it support session, dbd, filter and other, so more flexible.  It
use apreq, lua-apr[ https://github.com/zhaozg/lua-apr ],and merge function
from  http://people.apache.org/~humbedooh/lua_ap/.


2012/8/6 Daniel Gruno rum...@cord.dk

 If no one objects, I'll start moving in some functions to the mod_lua
 core, starting with the ones that pertain to obtaining a static value
 from the request/server, as well as the flush and sendfile function, and
 making them part of the request_rec package. This includes the following
 (as they will appear when imported):

 r:flush() - Flushes the output buffer
 r:sendfile(filename) -  Sends a file using sendfile if available
 r.port -the port in use by the request
 r.banner -  the server banner
 r.options - the Options directive for the request
 r.allowoverrides -  the AllowOverride directive for the request
 r.started - the time the server was (re)started
 r.basic_auth_pw -   the basic auth password, if any was sent
 r.limit_req_body -  The current request body limit (or 0 for none)
 r.server_built -The time the server was built
 r.is_initial_req -  Whether this is the initial request or a subreq
 r.remaining -   The remaining bytes in the request body
 r.some_auth_required -  Whether some authorization is/was required
 r.server_name - The server name for the request
 r.auth_name -   The realm used (if any) for authorization

 This leaves the following functions still in the apache2 package -
 If you'd rather see any of them moved to the request_rec package, do say
 so - :

 apache2.base64_encode - Encode a string in base64
 apache2.base64_decode - Decode a base64 string
 apache2.md5 -   Generate an MD5 hash
 apache2.sha1 -  Generate a SHA-1 hash
 apache2.escape -URL-escape a string
 apache2.unescape -  unescape an URL-encoded string
 apache2.mpm_query - Query the MPM for information
 apache2.expr -  Evaluate an ap_expr string
 apache2.scoreboard_process -Query the process scoreboard
 apache2.scoreboard_worker - Query a worker scoreboard
 apache2.clock - Returns the current time in microseconds
 apache2.requestbody -   Fetches (or saves) the request body
 apache2.dbopen -Opens up a database connection
 (supports both apr_dbd and mod_dbd)
 apache2.add_input_filter -  Adds an input filter to the request
 apache2.module_info -   Queries the server for info about a mod
 apache2.loaded_modules -Lists all the loaded modules
 apache2.runtime_dir_relative -  Returns a path relative to runtime dir
 apache2.server_info -   Returns information about the executable
 apache2.set_document_root - Sets the document root for a request
 apache2.add_version_component - Adds a version component
 apache2.os_escape_path -Escapes a path as a URL
 apache2.strcmp_match -  Does a strcmp_match (the foo* kind)
 apache2.set_keepalive - Set the keepalive status for a request
 apache2.make_etag - Creates an entity tag
 apache2.send_interim_response - Sends an interim response (or does it?)
 apache2.custom_response -   Sets a custom response for an error msg
 apache2.exists_config_define -  Query whether a define was made
 apache2.state_query -   Queries the server for state info
 apache2.stat -  Stats a file and returns info as a table
 apache2.regex - Evaluates regular expressions
 apache2.sleep - Sleeps for N seconds (accepts floats)
 apache2.get_server_name_for_url Servername for URL purposes

 Full descriptions and examples are still available at
 http://people.apache.org/~humbedooh/lua_ap/ if you need more info.

 If anyone has any other requests for internal functions they'd like to
 use in mod_lua, just speak up, I'm always happy to include more
 functionality.

 With regards,
 Daniel.



Re: Time for httpd 2.4.0-RC1 ??

2011-12-12 Thread zhiguo zhao
mod_lua document is not match with source code.
A lot of instruction removed or added.

2011/12/12 Eric Covener cove...@gmail.com

 On Mon, Dec 12, 2011 at 9:14 AM, zhiguo zhao zha...@gmail.com wrote:
  -1
 
  I think document is not finished.

 Which documents specifically?  I think we'll settle for a long way
 from finished for documentation, like adequate.



Re: Time for httpd 2.4.0-RC1 ??

2011-12-11 Thread zhiguo zhao
-1

I think document is not finished.

2011/12/12 Graham Leggett minf...@sharp.fm

 On 11 Dec 2011, at 15:01, Jim Jagielski j...@jagunet.com wrote:

  Now that apu-1.4.1 is close to release, it looks like we are
  close to being able to have our 1st RC for 2.4.0...
 
  My plan is to TR sometime this week...

 +1.

 Regards,
 Graham
 --




Report a Bug In truck and 2.4.x at winnt mpm, I think very important

2011-11-16 Thread zhiguo zhao
request_rec-connection-current_thread is a new feature, and
every request_rec-connection-current_thread should have different pool,
but now with a same pool,
This is need to fix.



Index: mpm/winnt/child.c
===
--- mpm/winnt/child.c   (版本 1202642)
+++ mpm/winnt/child.c   (工作副本)
@@ -754,9 +754,11 @@
 int rc;
 conn_rec *c;
 apr_int32_t disconnected;
+apr_pool_t* self;

 osthd = apr_os_thread_current();
-apr_os_thread_put(thd, osthd, pchild);
+apr_pool_create(self,pchild);
+apr_os_thread_put(thd, osthd, self);

 while (1) {

@@ -858,6 +860,7 @@

 ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
 (request_rec *) NULL);
+apr_pool_destroy(self);

 return 0;
 }


Re: Report a Bug In truck and 2.4.x at winnt mpm, I think very important

2011-11-16 Thread zhiguo zhao
Give chance to other module save thread-scope information, Please.

在 2011年11月16日 下午8:20,zhiguo zhao zha...@gmail.com写道:

 request_rec-connection-current_thread is a new feature, and
 every request_rec-connection-current_thread should have different pool,
 but now with a same pool,
 This is need to fix.



 Index: mpm/winnt/child.c
 ===
 --- mpm/winnt/child.c   (版本 1202642)
 +++ mpm/winnt/child.c   (工作副本)
 @@ -754,9 +754,11 @@
  int rc;
  conn_rec *c;
  apr_int32_t disconnected;
 +apr_pool_t* self;

  osthd = apr_os_thread_current();
 -apr_os_thread_put(thd, osthd, pchild);
 +apr_pool_create(self,pchild);
 +apr_os_thread_put(thd, osthd, self);

  while (1) {

 @@ -858,6 +860,7 @@

  ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
  (request_rec *) NULL);
 +apr_pool_destroy(self);

  return 0;
  }



A bug, apr_os_thread_current() not equal r-connection-current_thread

2011-11-15 Thread zhiguo zhao
Hi,
   I failed with this on windows with branch 2.4.x,  in a handle hook,

apr_os_thread_t t = apr_os_thread_current();
apr_os_thread_t *t1;
apr_os_thread_get(t1,  r-connection-current_thread);
printf(EQUALS %d\n,apr_os_thread_equal(t,t1));

I think t and t1 must be equal, But it Not.

I think this is a bug, Is this?


Re: A bug, apr_os_thread_current() not equal r-connection-current_thread

2011-11-15 Thread zhiguo zhao
Why not.
In mpm\winnt\child.c


/*
 * worker_main()
 * Main entry point for the worker threads. Worker threads block in
 * win*_get_connection() awaiting a connection to service.
 */
static DWORD __stdcall worker_main(void *thread_num_val)
{
apr_thread_t *thd = NULL;
apr_os_thread_t osthd;
static int requests_this_child = 0;
winnt_conn_ctx_t *context = NULL;
int thread_num = (int)thread_num_val;
ap_sb_handle_t *sbh;
apr_bucket *e;
int rc;
conn_rec *c;
apr_int32_t disconnected;

/* here get real os thread */
osthd = apr_os_thread_current();
/* create a apr_thread_t */
apr_os_thread_put(thd, osthd, pchild);

/*osthd and thd will not changed */

while (1) {

ap_update_child_status_from_indexes(0, thread_num, SERVER_READY,
NULL);

/* Grab a connection off the network */
context = winnt_get_connection(context);

if (!context) {
/* Time for the thread to exit */
break;
}

/* Have we hit MaxConnectionsPerChild connections? */
if (ap_max_requests_per_child) {
requests_this_child++;
if (requests_this_child  ap_max_requests_per_child) {
SetEvent(max_requests_per_child_event);
}
}

e = context-overlapped.Pointer;

ap_create_sb_handle(sbh, context-ptrans, 0, thread_num);
c = ap_run_create_connection(context-ptrans, ap_server_conf,
 context-sock, thread_num, sbh,
 context-ba);

if (!c)
{
/* ap_run_create_connection closes the socket on failure */
context-accept_socket = INVALID_SOCKET;
if (e)
apr_bucket_free(e);
continue;
}

/* c-current_thread changed, the thd */
c-current_thread = thd;

/* follow ap_process_connection(c, context-sock) logic
 * as it left us no chance to reinject our first data bucket.
 */
ap_update_vhost_given_ip(c);

rc = ap_run_pre_connection(c, context-sock);
if (rc != OK  rc != DONE) {
c-aborted = 1;
}

if (e  c-aborted)
{
apr_bucket_free(e);
}
else if (e)
{
core_ctx_t *ctx;
core_net_rec *net;
ap_filter_t *filt;

filt = c-input_filters;
while ((strcmp(filt-frec-name, core_in) != 0)  filt-next)
filt = filt-next;
net = filt-ctx;
ctx = net-in_ctx;

if (net-in_ctx)
ctx = net-in_ctx;
else
{
ctx = apr_pcalloc(c-pool, sizeof(*ctx));
ctx-b = apr_brigade_create(c-pool, c-bucket_alloc);
ctx-tmpbb = apr_brigade_create(c-pool, c-bucket_alloc);

/* seed the brigade with AcceptEx read heap bucket */
e = context-overlapped.Pointer;
APR_BRIGADE_INSERT_HEAD(ctx-b, e);

/* also seed the brigade with the client socket. */
e = apr_bucket_socket_create(net-client_socket,
 c-bucket_alloc);
APR_BRIGADE_INSERT_TAIL(ctx-b, e);
net-in_ctx = ctx;
}
}

if (!c-aborted)
{
ap_run_process_connection(c);

apr_socket_opt_get(context-sock, APR_SO_DISCONNECTED,
   disconnected);

if (!disconnected) {
context-accept_socket = INVALID_SOCKET;
ap_lingering_close(c);
}
}
}

ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
(request_rec *) NULL);

return 0;
}


2011/11/16 William A. Rowe Jr. wr...@rowe-clan.net

 On 11/15/2011 7:43 AM, zhiguo zhao wrote:

 Hi,
I failed with this on windows with branch 2.4.x,  in a handle hook,

 apr_os_thread_t t = apr_os_thread_current();
 apr_os_thread_t *t1;
 apr_os_thread_get(t1,  r-connection-current_thread)**;
 printf(EQUALS %d\n,apr_os_thread_equal(t,**t1));

 I think t and t1 must be equal, But it Not.

 I think this is a bug, Is this?


 No, it's not.

 /**
  * Compare two thread id's
  * @param tid1 1st Thread ID to compare
  * @param tid2 2nd Thread ID to compare
  * @return non-zero if the two threads are equal, zero otherwise
  */
 APR_DECLARE(int) apr_os_thread_equal(apr_os_**thread_t tid1,
 apr_os_thread_t tid2);

 This behavior is by design, use the designated comparator.



Re: A bug, apr_os_thread_current() not equal r-connection-current_thread

2011-11-15 Thread zhiguo zhao
Sorry, I make a mistack.


apr_os_thread_t t = apr_os_thread_current();
apr_os_thread_t *t1;
apr_os_thread_get(t1,  r-connection-current_thread);
printf(EQUALS %d\n,apr_os_thread_equal(t, *t1));
Tow different type data to comp, so it's will fail.


May be a bug in mod_session based (cookie), two times Set-Cookie in response headers!

2011-10-01 Thread zhiguo zhao
Hi all,

   I found when I enable mod_session with cookie, everytime response have
tow times Set-Cookie.
  I found function session_cookie_save react to both headers_out and
err_headers_out, then when send header call function
ap_http_header_filter, apr_table_overlay  headers_out and err_headers_out,

 I think this may be a bugs. Please notice that.


Re: mod_lua Filter Hook?

2011-06-08 Thread zhiguo zhao
I write a module named mod_luaex, it work with mod_lua, and extend lua
functions that support mod_dbd,mod_session and filter.

Mod_lua will not do big enhance and update according to mod_lua's author
message three month ago.

2011/6/9 Joachim Zobel jzo...@heute-morgen.de

 Hi.

 Will the mod_lua filter hook be implemented in the near future? I am
 aware that this requires wrapping buckets and brigades, which is a lot
 of work. Are there any plans for generated API wrappers as mod_perl has
 them?

 Sincerely,
 Joachim





patch for mod_lua (correct lua_open_hook )

2011-03-27 Thread zhiguo zhao
Hi, nice people.

Please patch to head trunk.

Add ap_lua_run_lua_open to run lua_open hooks provider by other modules.


Index: mod_lua.c
===
--- mod_lua.c   (版本 1085879)
+++ mod_lua.c   (工作副本)
@@ -59,11 +59,11 @@
 ap_lua_load_apache2_lmodule(L);
 ap_lua_load_request_lmodule(L, p);
 ap_lua_load_config_lmodule(L);
+ap_lua_run_lua_open(L, p);
 }

 static int lua_open_hook(lua_State *L, apr_pool_t *p)
 {
-lua_open_callback(L, p, NULL);
 return OK;
 }


mod_lua.diff
Description: Binary data


Re: mod_lua broken - was: NetWare autobuild httpd-HEAD / apr-HEAD failed

2011-03-15 Thread zhiguo zhao
Please try remove *.h, *.c in mod_lua, and update from svn again.
later i will test it on linux.



2011/3/16 Guenter Knauf fua...@apache.org

 Hi all,
 I just want to clarify that the mail below is not my new nag mailer, but an
 automatically generated mail from a Linux box which builds the NetWare
 target of httpd-HEAD + APR-HEAD all six hours from SVN ...
 I was today self suprised how nicely it works ... :-)
 Did setup the stuff a few days back right after I got it working when I
 commited the bunch of build system changes, and already forgot about (but
 the cronjob didnt forget to run ...)
 also sorry that I did not yet look into the issue closer since I was whole
 day busy with other stuff ...
 if nobody objetcs I would like to let the cronjob continue, and once a fix
 is commited the mails should stop again.

 Gün.


 Am 16.03.2011 00:17, schrieb fua...@apache.org:

 Complete buildlog:
 http://svwe20.itex.at/autobuilds/asf/httpd/201103152310-netware-httpd.txt.gz

 =
 Exporting httpd-trunk ...
 Path: trunk
 URL: http://svn.apache.org/repos/asf/httpd/httpd/trunk
 Repository Root: http://svn.apache.org/repos/asf
 Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
 Revision: 1081988
 Node Kind: directory
 Last Changed Author: rbowen
 Last Changed Rev: 1081935
 Last Changed Date: 2011-03-15 21:41:26 +0100 (Tue, 15 Mar 2011)

 Exporting apr-trunk ...
 Path: trunk
 URL: http://svn.apache.org/repos/asf/apr/apr/trunk
 Repository Root: http://svn.apache.org/repos/asf
 Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
 Revision: 1081988
 Node Kind: directory
 Last Changed Author: trawick
 Last Changed Rev: 1081495
 Last Changed Date: 2011-03-14 18:59:43 +0100 (Mon, 14 Mar 2011)


 =
 ### /home/prg/nlm/cwcmdl40/mwccnlm.exe Compiler:
 #File: lua_vmprep.c
 # -
 # 394: if
 (apr_pool_userdata_get(reslist,mod_lua,spec-pool)==APR_SUCCESS) {
 #   Error:^
 #   illegal implicit conversion from 'struct apr_reslist_t **' to
 #   'void **'
 ### /home/prg/nlm/cwcmdl40/mwccnlm.exe Compiler:
 # 409: apr_reslist_acquire(reslist,L);
 #   Error:^
 #   illegal implicit conversion from 'struct lua_State **' to
 #   'void **'
 ### /home/prg/nlm/cwcmdl40/mwccnlm.exe Compiler:
 # 413: apr_pool_userdata_set(L, spec-file, vm_release,
 lifecycle_pool);
 #   Error:
  ^
 #   illegal implicit conversion from 'int (struct lua_State *)' to
 #   'int (*)(void *)'
 ### /home/prg/nlm/cwcmdl40/mwccnlm.exe Compiler:
 # 423: if(!vm_construct(L, spec, lifecycle_pool))
 #   Error:  ^
 #   illegal implicit conversion from 'struct lua_State **' to
 #   'void **'

 =






patch to mod_lua(support server scope, better performance)

2011-03-10 Thread zhiguo zhao
Hi,

   Some days I post my first letter(
http://mail-archives.apache.org/mod_mbox/httpd-dev/201103.mbox/raw/%3CAANLkTimfg4yeGExZXNP=yjybjdrmhrqpb4jo--sn6...@mail.gmail.com%3E)
in http-dev, but the letter can be send to every's box with some reason.,

   And now I update mod_lua to support lua server scope with
apr_reslist_apis, and I do some test with ab on my Pc.
   I got better performance. (75 - 227 - 277)  #/s
   Change please see patch file, I hope this patch can be merge in svn..  :)

mod_lua in svn,head version
---
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   13.310 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:75.13 [#/sec] (mean)
Time per request:   665.500 [ms] (mean)
Time per request:   13.310 [ms] (mean, across all concurrent requests)
Transfer rate:  12.03 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.5  1   5
Processing:89  662 1946.32139253
Waiting:   89  658 1938.12129236
Total: 90  662 1946.32149253

Percentage of the requests served within a certain time (ms)
  50%214
  66%221
  75%228
  80%235
  90%274
  95%   9012
  98%   9147
  99%   9152
 100%   9253 (longest request)

 mod_lua updated, Lua_Scope is once
---
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   4.393 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:227.63 [#/sec] (mean)
Time per request:   219.650 [ms] (mean)
Time per request:   4.393 [ms] (mean, across all concurrent requests)
Transfer rate:  36.46 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.9  1  14
Processing:58  215  34.1216 317
Waiting:   56  210  36.6214 314
Total: 59  216  34.1217 318

Percentage of the requests served within a certain time (ms)
  50%217
  66%227
  75%235
  80%240
  90%251
  95%265
  98%282
  99%301
 100%318 (longest request)


mod_lua updated, with Lua_Scope server 10 50
--
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   3.606 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:277.32 [#/sec] (mean)
Time per request:   180.300 [ms] (mean)
Time per request:   3.606 [ms] (mean, across all concurrent requests)
Transfer rate:  44.41 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.6  1   7
Processing:43  176  24.9175 272
Waiting:   36  174  27.3173 262
Total: 44  177  24.9176 272

Percentage of the requests served within a certain time (ms)
  50%176
  66%184
  75%189
  80%192
  90%201
  95%216
  98%233
  99%242
 100%272 (longest request)


mod_lua.diff
Description: Binary data


Fwd: patch to mod_lua(support server scope, better performance)

2011-03-10 Thread zhiguo zhao
Hi,

   Some days I post my first letter(
http://mail-archives.apache.org/mod_mbox/httpd-dev/201103.mbox/raw/%3CAANLkTimfg4yeGExZXNP=yjybjdrmhrqpb4jo--sn6...@mail.gmail.com%3E)
in http-dev, but the letter can be send to every's box with some reason.,

   And now I update mod_lua to support lua server scope with
apr_reslist_apis, and I do some test with ab on my Pc.
   I got better performance. (75 - 227 - 277)  #/s
   Change please see patch file, I hope this patch can be merge in svn..  :)

mod_lua in svn,head version
---
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   13.310 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:75.13 [#/sec] (mean)
Time per request:   665.500 [ms] (mean)
Time per request:   13.310 [ms] (mean, across all concurrent requests)
Transfer rate:  12.03 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.5  1   5
Processing:89  662 1946.32139253
Waiting:   89  658 1938.12129236
Total: 90  662 1946.32149253

Percentage of the requests served within a certain time (ms)
  50%214
  66%221
  75%228
  80%235
  90%274
  95%   9012
  98%   9147
  99%   9152
 100%   9253 (longest request)

 mod_lua updated, Lua_Scope is once
---
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   4.393 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:227.63 [#/sec] (mean)
Time per request:   219.650 [ms] (mean)
Time per request:   4.393 [ms] (mean, across all concurrent requests)
Transfer rate:  36.46 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.9  1  14
Processing:58  215  34.1216 317
Waiting:   56  210  36.6214 314
Total: 59  216  34.1217 318

Percentage of the requests served within a certain time (ms)
  50%217
  66%227
  75%235
  80%240
  90%251
  95%265
  98%282
  99%301
 100%318 (longest request)


mod_lua updated, with Lua_Scope server 10 50
--
This is ApacheBench, Version 2.3 $Revision: 1004962 $
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:Apache/2.3.12-dev
Server Hostname:localhost
Server Port:80

Document Path:  /simple.lua
Document Length:9 bytes

Concurrency Level:  50
Time taken for tests:   3.606 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  164000 bytes
HTML transferred:   9000 bytes
Requests per second:277.32 [#/sec] (mean)
Time per request:   180.300 [ms] (mean)
Time per request:   3.606 [ms] (mean, across all concurrent requests)
Transfer rate:  44.41 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.6  1   7
Processing:43  176  24.9175 272
Waiting:   36  174  27.3173 262
Total: 44  177  24.9176 272

Percentage of the requests served within a certain time (ms)
  50%176
  66%184
  75%189
  80%192
  90%201
  95%216
  98%233
  99%242
 100%272 (longest request)
--patch
file-
Index: lua_vmprep.c
===
--- lua_vmprep.c (版本 1080084)
+++ lua_vmprep.c (工作副本)
@@ -288,79 +288,141 @@

 #endif