You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Doug MacEachern <do...@opengroup.org> on 1997/07/29 02:54:55 UTC
ApacheModulePerl.dll
First, I want to say again, outstanding work on the NT port, it looks
great! mod_dll is icing on the cake, with that and mod_perl1.00-tobe:
LoadModule perl_module modules/ApacheModulePerl
works like a charm. I thought you'd be interested to see these
numbers. `cgi' + `perl' run the same script where /cgi-bin triggers
mod_cgi and /perl triggers mod_perl. The script pulls in a few
modules, CGI.pm, DBI/DBD::ODBC and LWP::UserAgent, but just prints
"ok". `static' is a text file containing only "ok". These are each
fetched 100 times with LWP:
Benchmark: timing 100 iterations of cgi, perl, static...
cgi: 247 secs ( 1.78 usr 0.15 sys = 1.93 cpu)
perl: 6 secs ( 1.43 usr 0.12 sys = 1.55 cpu)
static: 5 secs ( 1.73 usr 0.13 sys = 1.86 cpu)
The cpu usage measurements:
cgi: I can hear my machine grinding miserably
perl: I cannot hear my machine grind
static: I cannot hear my machine grind
:-)
And, of course, mod_perl can tap into all the apache API
functionality under NT as it can under unix, modulo a few that need
{API,MODULE_VAR}_EXPORT:
these for -DPERL_SECTIONS (<Perl></Perl>)
handle_command
limit_section
init_virtual_host
add_per_url_conf
core_module
create_per_dir_config
add_per_dir_conf
find_command_in_modules
top_module
misc:
basic_http_header
max_requests_per_child
log_transaction
translate_name
Any objections to these being exported?
-Doug
Re: ApacheModulePerl.dll
Posted by Ben Laurie <be...@algroup.co.uk>.
Doug MacEachern wrote:
> And, of course, mod_perl can tap into all the apache API
> functionality under NT as it can under unix, modulo a few that need
> {API,MODULE_VAR}_EXPORT:
Don't forget that you have to use API_VAR_EXPORT to export vars from the
core to DLLs. Strange, but true.
Cheers,
Ben.
--
Ben Laurie Phone: +44 (181) 994 6435 Email:
ben@algroup.co.uk
Freelance Consultant and Fax: +44 (181) 994 6472
Technical Director URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd, Apache Group member (http://www.apache.org)
London, England. Apache-SSL author
Re: ApacheModulePerl.dll
Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 28 Jul 1997, Doug MacEachern wrote:
> max_requests_per_child
(I'll comment on the rest later.)
I'm thinking we should have a struct global_conf where all these global
config values are stored, and then export that.
Oh yeah, I'm curious why you use basic_http_header instead of
send_http_header. Maybe our abstraction is wrong there.
Dean
Re: ApacheModulePerl.dll
Posted by Alexei Kosut <ak...@organic.com>.
On Wed, 30 Jul 1997, Dean Gaudet wrote:
> > max_requests_per_child
> > log_transaction
> > translate_name
>
> Here's a patch that does the rest ...
I am curious to know why these three are needed. Especially the last
two. These seem to me things that should really stay internal to
http_request.c, and shouldn't ever leave.
(I suppose max_requests_per_child is used for something like checking to
see if it is the last request the child is making, so you can do cleanup
stuff?)
-- Alexei Kosut <ak...@organic.com>
Re: ApacheModulePerl.dll
Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 28 Jul 1997, Doug MacEachern wrote:
> these for -DPERL_SECTIONS (<Perl></Perl>)
> handle_command
> limit_section
> init_virtual_host
> add_per_url_conf
> core_module
> create_per_dir_config
> add_per_dir_conf
> find_command_in_modules
> top_module
I'm curious ... how many of these would you need if we made an
srm_command_loop which called a getline supplied by the caller? i.e.
instead of invoking all the core things directly, what if we gave you an
interface where you could pass, line-by-line, arbitrary sections of config
files?
> misc:
> basic_http_header
We already discussed not including this one.
> max_requests_per_child
> log_transaction
> translate_name
Here's a patch that does the rest ...
Dean
Index: http_conf_globals.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_conf_globals.h,v
retrieving revision 1.15
diff -u -r1.15 http_conf_globals.h
--- http_conf_globals.h 1997/07/27 02:15:45 1.15
+++ http_conf_globals.h 1997/07/30 19:04:13
@@ -61,7 +61,7 @@
#ifdef MULTIPLE_GROUPS
extern gid_t group_id_list[NGROUPS_MAX];
#endif
-extern int max_requests_per_child;
+extern MODULE_VAR_EXPORT int max_requests_per_child;
extern int threads_per_child;
extern int excess_requests_per_child;
extern struct in_addr bind_address;
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.68
diff -u -r1.68 http_config.c
--- http_config.c 1997/07/28 18:22:42 1.68
+++ http_config.c 1997/07/30 19:04:15
@@ -200,7 +200,7 @@
return create_empty_config (p);
}
-void *create_per_dir_config (pool *p) {
+API_EXPORT(void *) create_per_dir_config (pool *p) {
return create_empty_config (p);
}
@@ -348,7 +348,7 @@
return run_all ? OK : DECLINED;
}
-int translate_name(request_rec *r) {
+API_EXPORT(int) translate_name(request_rec *r) {
return run_method (r, offsets_into_method_ptrs.translate_handler, 0);
}
@@ -364,7 +364,7 @@
return run_method (r, offsets_into_method_ptrs.fixer_upper, 1);
}
-int log_transaction (request_rec *r) {
+API_EXPORT(int) log_transaction (request_rec *r) {
return run_method (r, offsets_into_method_ptrs.logger, 1);
}
@@ -728,7 +728,7 @@
return NULL;
}
-const command_rec *find_command_in_modules (const char *cmd_name, module **mod)
+API_EXPORT(const command_rec *) find_command_in_modules (const char *cmd_name, module **mod)
{
const command_rec *cmdp;
module *modp;
@@ -742,7 +742,7 @@
return NULL;
}
-const char *handle_command (cmd_parms *parms, void *config, const char *l)
+API_EXPORT(const char *) handle_command (cmd_parms *parms, void *config, const char *l)
{
const char *args, *cmd_name, *retval;
const command_rec *cmd;
@@ -1028,7 +1028,7 @@
if (t != NULL) *t = ':';
}
-server_rec *init_virtual_host (pool *p, const char *hostname,
+API_EXPORT(server_rec *) init_virtual_host (pool *p, const char *hostname,
server_rec *main_server)
{
server_rec *s = (server_rec *)pcalloc (p, sizeof (server_rec));
Index: http_config.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.h,v
retrieving revision 1.41
diff -u -r1.41 http_config.h
--- http_config.h 1997/07/28 18:22:43 1.41
+++ http_config.h 1997/07/30 19:04:16
@@ -296,7 +296,7 @@
/* For http_request.c... */
void *create_request_config (pool *p);
-void *create_per_dir_config (pool *p);
+API_EXPORT(void *) create_per_dir_config (pool *p);
void *merge_per_dir_configs (pool *p, void *base, void *new);
/* For http_core.c... (<Directory> command and virtual hosts) */
@@ -311,7 +311,7 @@
/* Module-method dispatchers, also for http_request.c */
-int translate_name (request_rec *);
+API_EXPORT(int) translate_name (request_rec *);
int directory_walk (request_rec *); /* check symlinks, get per-dir config */
int check_access (request_rec *); /* check access on non-auth basis */
int check_user_id (request_rec *); /* obtain valid username from client auth */
@@ -319,7 +319,19 @@
int find_types (request_rec *); /* identify MIME type */
int run_fixups (request_rec *); /* poke around for other metainfo, etc.... */
int invoke_handler (request_rec *);
-int log_transaction (request_rec *r);
+API_EXPORT(int) log_transaction (request_rec *r);
int header_parse (request_rec *);
+
+/* For mod_perl */
+
+API_EXPORT(const char *) handle_command (cmd_parms *parms, void *config, const char *l);
+API_EXPORT(const char *) limit_section (cmd_parms *cmd, void *dummy, const char *arg);
+API_EXPORT(server_rec *) init_virtual_host (pool *p, const char *hostname,
+ server_rec *main_server);
+API_EXPORT(void) add_per_url_conf (server_rec *s, void *url_config);
+API_EXPORT(void) add_per_dir_conf (server_rec *s, void *dir_config)
+API_EXPORT(const command_rec *) find_command_in_modules (const char *cmd_name, module **mod);
+extern MODULE_VAR_EXPORT module *top_module;
+extern MODULE_VAR_EXPORT module core_module;
#endif
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.102
diff -u -r1.102 http_core.c
--- http_core.c 1997/07/30 18:41:51 1.102
+++ http_core.c 1997/07/30 19:04:20
@@ -210,7 +210,7 @@
* these are part of the core server config.
*/
-void add_per_dir_conf (server_rec *s, void *dir_config)
+API_EXPORT(void) add_per_dir_conf (server_rec *s, void *dir_config)
{
core_server_config *sconf = get_module_config (s->module_config,
&core_module);
@@ -219,7 +219,7 @@
*new_space = dir_config;
}
-void add_per_url_conf (server_rec *s, void *url_config)
+API_EXPORT(void) add_per_url_conf (server_rec *s, void *url_config)
{
core_server_config *sconf = get_module_config (s->module_config,
&core_module);
@@ -601,7 +601,7 @@
return NULL;
}
-const char *limit_section (cmd_parms *cmd, void *dummy, const char *arg)
+API_EXPORT(const char *) limit_section (cmd_parms *cmd, void *dummy, const char *arg)
{
const char *limited_methods = getword(cmd->pool,&arg,'>');
int limited = 0;
Re: ApacheModulePerl.dll
Posted by Rob Hartill <ro...@imdb.com>.
On Mon, 28 Jul 1997, Doug MacEachern wrote:
> Benchmark: timing 100 iterations of cgi, perl, static...
> cgi: 247 secs ( 1.78 usr 0.15 sys = 1.93 cpu)
> perl: 6 secs ( 1.43 usr 0.12 sys = 1.55 cpu)
> static: 5 secs ( 1.73 usr 0.13 sys = 1.86 cpu)
The next magazine to do a benchmark should be told to use mod_perl :-)