Getting at server's MaxClients setting?

2002-11-27 Thread Bas A . Schulte
Hi,

is it possible to get at the configured MaxClients setting from within 
my handler?

I checked Apache::Server which gives you some configuration information 
but there's no accessor for MaxClients.

Any other, easy, way?




Re: Getting at server's MaxClients setting?

2002-11-27 Thread Bas A . Schulte
Geoff,

On Wednesday, November 27, 2002, at 03:07 PM, Geoffrey Young wrote:


in this case, MaxClients looks like it calls ap_daemons_limit to make 
the setting, so you may be able to create a subclass that offers up 
that API to perl-land.  for more information on how, you can check out 
the slides from my recent ApacheCon talk:

http://www.modperlcookbook.org/~geoff/slides/ApacheCon/oo-mod_perl-printable.
ppt.gz

hmm... sounds like another good idea to add to my next talk :)

Well, for the moment, I'll grep for it in the current httpd.conf ;)

Just thought I'd ask in case I was missing something obvious.

Thanks,

Bas.





MySQL prepared sql statements?

2002-11-24 Thread Bas A . Schulte
Hi,

I'm wondering if I would gain (some) performance by preparing my sql 
statements once during ChildInit when using MySQL? Does it cache 
execution plans for sql statements? I know it makes a big difference on 
Oracle but I'm not sure what MySQL is like in this respect.

Regards,

Bas.




IPC suggestions sought/talking between children?

2002-10-23 Thread Bas A . Schulte
Hi all,

I'm looking for some suggestions on a problem I'm looking at. I have a 
mod_perl handler running that sends out certain push messages (could be 
e-mail, could be an http post etc.) for several customers that are 
identified by a unique identifier.

Examples:

http://my.server.com/myhandler?target=customerAdata=sendthis

http://my.server.com/myhandler?target=customerBdata=sendthat

Now what I want to do is restrict the number of concurrent running 
requests per customer. For example, if 5 apache children are running my 
handler on behalf of customer A, I want my handler to do something else 
with a new request for customer A. I don't want to throw away the 6th 
request but slap it in some queue for later processing.

I looked at mod_throttle and similar offerings but they tend to throw 
away requests when there are too many concurrent requests or when 
bandwidht is higher than some defined max.. That's not what I want.

What I really need is some form of IPC between apache children so one 
child can find out what other children are currently doing.

I've been thinking about IPC::Shareable but I have had some bad 
experience with it (longish ago though).

Anyone got some pointers for me to look at? Is there something hidden in 
the Apache API that I might use from mod_perl?

Regards,

Bas.




FYI: MySQL default max_connections

2002-10-22 Thread Bas A . Schulte
Hi all,

just recovering from a major spike on our MySQL server and thought I'd 
share something *I* didn't know...

We got a db box with MySQL on it and 2 (mod_perl) webservers on separate 
boxes, the mod_perl servers have MaxClients set to 160 for one machine 
and 40 for the other. Now we had a little spike this evening and what 
happened was this:

DBD::mysql::st execute failed: Too many connections at 
/opt/ttgp/prod/ttgp/lib/TTGP/ObjectServer.pm line 245.

After some digging around it appears that MySQL default max. number of 
connections is 100, no matter how much RAM you stuck in your server! So 
even though I had no real problems with my webservers, MySQL didn't 
allow new connections.

I added this to /etc/my.cnf (and restarted mysqld):

[mysqld]
...
set-variable = max_connections=300
...

Now I can have my 200 connections again and actually use that precious 
RAM in my db server ;)

Just thought I'd mention it if you ever get caught with this problem.

Regards,

Bas.




Apache/mod_perl still not ready for OS X?

2002-06-08 Thread Bas A . Schulte

Hi,

I've been postponing to move my Linux Apache/mod_perl development to my 
highly appreciated iBook running Mac OS X due to all the required tweaks 
until now. I would imagine things have been sorted out by now so I 
downloaded apache 1.3.24 to give it a go.

The system I'm working on has a self-contained build-script which 
fetches everything from CVS, executes the right build commands etc. 
without me having to think. This has a built-in step to compile mod_perl 
statically (i.e. not DSO as i don't want that) into Apache.

Now I find that out that the part that compiles Apache bails out with 
this:

env LD_RUN_PATH=/opt/ttgp/dev/applications/perl/lib/5.6.1/darwin/CORE cc 
-c -I.. -I/opt/ttgp/dev/applications/perl/lib/5.6.1/darwin/CORE 
-I../os/unix -I../include   -DDARWIN -DMOD_PERL -DUSE_PERL_SSI -pipe 
-fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -DUSE_HSREGEX 
-DNO_DL_NEEDED -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE 
-fno-strict-aliasing `../apaci` alloc.c
alloc.c: In function `spawn_child_core':
alloc.c:2291: `STDOUT_FILENO' undeclared (first use in this function)
alloc.c:2291: (Each undeclared identifier is reported only once
alloc.c:2291: for each function it appears in.)
alloc.c:2297: `STDIN_FILENO' undeclared (first use in this function)
alloc.c:2303: `STDERR_FILENO' undeclared (first use in this function)
make[4]: *** [alloc.o] Error 1
make[3]: *** [subdirs] Error 1
make[2]: *** [build-std] Error 2
make[1]: *** [build] Error 2
make: *** [apaci_httpd] Error 2

I almost find this appalling. It can't find something basic as 
STDOUT_FILENO (which is in /usr/include/unistd.h)...

So I went back to Google to find solutions and the first hit sends me to 
stepwise.com to a tutorial that tells me in detail what commands to type 
in. Great, but it forces me to use DSO which I don't want!

So, what is missing in the Apache configuration part that will make this 
work in a sensible way?

Regards,

Bas.

ps. I know I'm a programmer that loves to tweak but when it comes to 
something as basic as this I'm just a user that's looking for the any 
key;)




Inline generation of error document?

2002-04-18 Thread Bas A. Schulte

Hi all,

I'm a little confused (honestly). I want to handle parameter errors in a 
content handler. When there's a parameter missing in the URL, my handler 
returns HTTP_BAD_REQUEST.

Now Apache sees the HTTP_BAD_REQUEST return value from my handler and 
generates an error (HTML) document.

How can I create this document right from within my handler? I could 
create another handler of course and use the ErrorDocument directive to 
point to that but I am wondering if I can do it in my handler directly.

Somehow I can't find this in the eagle book.

Any tips?

Bas.




Re: Non-web use for Apache/mod_perl

2002-03-21 Thread Bas A. Schulte

Issac,

On Thursday, March 21, 2002, at 11:01 AM, Issac Goldstand wrote:

 Bas A.Schulte wrote:

 Hi,

 I've been meaning to write an article about how I used Apache/mod_perl 
 to implement a mobile SMS application platform as it demonstrates use 
 of Apache/mod_perl outside the Web realm, something I hadn't seen so 
 far. Time constraints (as always) have prevented me from doing this 
 properly, however, I'll try to give a short description of the system.

 The goal kinda is to see if others are using Apache/mod_perl in a 
 similar way to share experiences, discuss issues that arise or discuss 
 alternatives (I'd love someone to tell me I'm an idiot for handling 
 all this lowlevel stuff myself and move to J2EE/java at once, if he 
 can convince me I could have implemented this with the same budget and 
 time frame).

 [snip]

 I actually implemented a similar system, although it's not SMS 
 specific. Basically, I have a central system in Apache/mod_perl.  The 
 eventual design is for full I/O in many protocols, including HTTP, 
 SMTP, FTP and a handful of other protocols.

Well, this proves again that everything we software developers do has 
been done umteen times before ;)

The system I described actually isn't tied to SMS as well; it has been 
designed with other devices in mind as well. The virtual SMSC component 
as I described it really should have a better name as it really is a 
protocal handler and serializing/deserializing component that is capable 
of handling other protocol and formats. In fact, I am considering 
enhancing it to be able to use it in a WAP or i-Mode context (if we can 
only find a way to get paid by the mobile subscriber using WAP which is 
easy with SMS).


 So far the output is pretty much ready, and I think I'm going to wait 
 for Apache 2 before I do the inputs.  I _could_ write mod_perl handlers 
 to understand other protocols, but Apache 2 is being designed around 
 this, as far as I understand, so I'm going to do that around Apache 2 
 (as soon as I get off my ass and learn the new API :-))

Yep; Apache 2 combined with mod_perl sure sounds interesting, now if it 
only had the stability that 1.x has ;)

Regards,

Bas.




Re: Non-web use for Apache/mod_perl

2002-03-21 Thread Bas A. Schulte

Hi,

On Thursday, March 21, 2002, at 11:39 AM, Ilya Martynov wrote:

 On Thu, 21 Mar 2002 00:40:24 +0100, Bas A.Schulte 
 [EMAIL PROTECTED] said:

 BAS To handle a large number of concurrent transactions in a
 BAS transaction-safe environment without me having to worry too much 
 about
 BAS concurrency issues and referential integrity I will slowly move to
 BAS Oracle. $dbh-do('LOCK TABLE USER, INSTANCE, APP_DATA') just plain
 BAS sucks unless you want to create a very large distributed 
 *single-user*
 BAS system running on multiple machines.

 Without changing SQL backend you can have transactions with
 MySQL. Just use InnoDB table type. It is faster than default table
 type for read/write intensive applications because it doesn't lock
 whole tables but provides Oracle style row-level locking.

I knew I shouldn't have mentioned MySQL and it's, possibly perceived, 
shortcomings ;)

I know about InnoDB, I know about Postgresql too, it's just that I 
really like Oracle for lots of reasons. I have no personal experience 
with running MySQL or Postgresql in a high-volume concurrent read/write 
transaction situation. It seems most MySQL success stories are about 
websites with 98% read-only transactions on the database which just 
isn't similar to my needs. I used MySQL myself for that type of problem 
and it sure worked.

If someone really wants to do another DB discussion, let's move that to 
a different discussion ;)

Bas.




Re: Non-web use for Apache/mod_perl

2002-03-20 Thread Bas A . Schulte

Hi,

On Thursday, March 21, 2002, at 12:57 AM, Drew Taylor wrote:

 Have you tried Postgresql? It's a free, fast, ACID compliant database. 
 I have it compiled  running within a few hours, not knowing much of 
 anything about it before hand. From what I've read the speed is 
 comparable w/ mysql for most applications.

 Drew

 At 12:40 AM 3/21/2002 +0100, Bas A.Schulte wrote:

 To handle a large number of concurrent transactions in a 
 transaction-safe environment without me having to worry too much about 
 concurrency issues and referential integrity I will slowly move to 
 Oracle. $dbh-do('LOCK TABLE USER, INSTANCE, APP_DATA') just plain 
 sucks unless you want to create a very large distributed *single-user* 
 system running on multiple machines.

I kinda was afraid about people getting excited about my RDBMS remarks 
which really is a subject in itself ;)

I have zero personal experience with Postgresql even though I've read 
good things about it so that ruled it out for a project with a very 
tight time frame. And I just happen to really, really like Oracle so 
unless the application generates some real money, I will probably always 
go far Oracle.

Regards,

Bas.