cookies cookies cookies

2000-12-12 Thread Greg Stark


How do I reliably remove a cookie from a browser's memory? I've only just
begun to experiment but it seems if I set the cookie to "" or undef
Apache::ASP doesn't send the right headers to remove the cookie. (Actually
undef seems to corrupt the cookie). I could just write a handler to set the
header appropriately but I'm not even sure what I should be putting in the
header.

-- 
greg




Re: HTTP Mod_Perl mini-server

2000-12-03 Thread Greg Stark

Perrin Harkins [EMAIL PROTECTED] writes:

 On Fri, 3 Nov 2000, Vivek Khera wrote:
  Lately I've been getting very interested in using solid-state disks
  for high-performance issues.  They're expensive, but if you need that
  much speed, they're worth it.
 
 Are they?  I tried one once, and it wasn't any faster than my normal disk
 because I had so much RAM it was all getting buffered already.  If you
 don't have enough RAM, it might help, but I suspect these are more
 expensive than equivalent amounts of RAM.

Solid state disks are very effective for particular applications like mail
spools and database logs where the application waits for data to be flushed to
disk before continuing. For most normal applications the same effect can be
obtained by adding RAM and/or playing with tools like memfs. 

-- 
greg


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: open(FH,'|qmail-inject') fails

2000-10-02 Thread Greg Stark


Doug MacEachern [EMAIL PROTECTED] writes:

 On Mon, 25 Sep 2000, Stas Bekman wrote:
  
  All you care about is to measure the time between email sending start and
  end (when the process continues on its execution flow). Why should one
  care about the details of internal implementation.
 
 i only skimmed the first part of this thread, but assumed if you're
 talking about performance, you'd want to compare the overall impact on
 your system(s) of Net::SMTP vs. |qmail-inject.  you cannot measure the
 overall impact just using Benchmark.pm is all i'm trying to clarify.

A better plan for such systems is to have a queue in your database for
parameters for e-mails to send. Insert a record in the database and let your
web server continue processing. 

Have a separate process possibly on a separate machine or possibly on multiple
machines do selects from that queue and deliver mail. I think the fastest way
is over a single SMTP connection to the mail relay rather than forking a
process to inject the mail.

This keeps the very variable -- even on your own systems -- mail latency
completely out of the critical path for web server requests. Which is really
the key measure that dictates the requests/s you can serve.

-- 
greg




Re: multilanguage site

2000-09-01 Thread Greg Stark


  can someone suggest me the best way to build a multilanguage web site
  (english, french, ..).
  I'm using Apache + mod_perl + Apache::asp (for applications)

I'm really interested in what other people are doing here. We've just released
our first cut at i18n and it's going fairly well. But so far we haven't dealt
with the big bugaboo, character encoding. 

One major problem I anticipate is what to do when individual include files are
not available in the local language. For iso-8859-1 encoded languages that's
not a major hurdle as we can simply use the english text until it's
translated. But for other encodings does it make sense to include english
text? 

If we use UTF-8 all the ascii characters would display properly, but do most
browsers support UTF-8 now? Or do people still use BIG5, EUS, etc? 

As far as I can tell there's no way in html to indicate to the browser that a
chunk of content is in some other encoding other than what was specified in
the headers or meta tag. There's no span charset=... attribute or anything
like that. This seems to make truly multilingual pages really awkward. You
basically must use an encoding like UTF-8 which can reach the entire unicode
character set or else you cannot mix languages.

-- 
greg




problem with mod_proxy/mod_rewrite being used for the front-end proxy

2000-08-21 Thread Greg Stark


This isn't entirely on-topic but it's a solution often suggested for mod_perl
users so I suspect there are other users here being bitten by the same
problems. In fact the manner in which problems manifest are such that it's
possible that many mod_perl users who are using mod_rewrite/mod_proxy to run
a reverse proxy in front of their heavyweight perl servers have a security
problem and don't even know it.

The problem is that the solution written in the mod_rewrite guide for a
reverse proxy doesn't work as advertised to block incoming proxy requests. 

RewriteRule^(http|ftp)://.*  -  [F]

This is supposed to block incoming proxy requests that aren't specifically
created by the rewrite rules that follow. 

The problem is that both mod_rewrite and mod_proxy have changed, and this
seems to no longer catch the incoming proxy requests. Instead mod_rewrite
seems to see just the path part of the URI, ie, /foo/bar/baz.pl without the
http://.../. 

I've even tried using ${THE_REQUEST} which actually matches, and says it's
forcing the response to be forbidden, then it happily proxies the request
anyways!


I'm using a
 Directory proxy:* 
  deny from all
 /Directory
 Directory proxy:http://127.0.0.1/
  allow from all
 /Directory


section to at least avoid being an open proxy to the outside world, but I
cannot find any way in 1.3.12 to refuse all proxy requests coming from the
outside.

If you're not aware of the problem at all and have merely followed the advice
of the mod_rewrite guide you are probably an open proxy, allowing attackers to
use your web server to attack other sites anonymously.

-- 
greg




Re: Apache::Perfmon 0.011

2000-08-21 Thread Greg Stark


Lupe Christoph [EMAIL PROTECTED] writes:

 Hmm. Apache::Benchmark sounds more like a benchmark driver to me.
 Apache::Instrumentation or so? Apache::Probe?

Profile or even just Prof.

I looked at this and really like the idea. Unfortunately I need to recompile
my Apache to use it.

What I think it needs is, a way to gather the statistics in a hash based on
the request. That way I can make a web page that pokes around in the hash
table and reports the average and maximum time taken by page.

I'm not clear how or if that can be done in a separate module like this that
doesn't know how the requests are dispatched. Either a regexp needs to be
provided that returns the key to use for the hash, or else something similar
needs to be integrated into packages like CGI and Apache::ASP. (Which was the
approach I was planning on taking myself.) I like this approach better though,
so it would be neat to see it polished.

-- 
greg




Re: speed up/load balancing of session-based sites

2000-05-07 Thread Greg Stark


   Further, what are the standard ways to load balance a session-tracking
   app across multiple servers when the sessions are stored in memory and a
   given user has to be consistently sent back to the same machine?  Can
   round-robin DNS be counted on to send people back to the same server
   over the life of a given session?
 
 On my sites I use a central database for storing the session objects, and
 all of the https servers access this central resource.  Obviously if it
 goes down, everything is toast, but the same can be said of the database
 that stores all of the customer information, etc.

I've written some pretty heavy database driven sites that do some pretty
complicated things and I've *never* found it really necessary to have a server
side session database. In theory you might find it convenient to cache big
complex data structures for the session, but in practice most people use it
for storing things like usernames and shopping cart contents. 

My suggestion is to put the state information in the cookie directly. Include
a crypto hash (with a secret) to sign the cookie and be done with it. If the
information is sensitive then encrypt the whole thing. 

Then your sessions are completely stateless, they can migrate between mod_perl
processes, even across servers. They can even survive server reboots. And They
don't require additional infrastructure to store the database of sessions.

I keep meaning to write this up as an Apache:: module, but it's pretty trivial
to cons up an application-specific version. The only thing this doesn't
provide is a way to deal with large data structures. But generally if the
application is big enough to need such data structures you have a real
database from which you can reconstruct the data on each request, just store
the state information in the cookie.

-- 
greg




Re: modproxy:modperl ratios...

2000-04-28 Thread Greg Stark


A few lessons on this arena:

1) Move your pictures to another server *even if you're using a proxy*
   Search back in the archives for my previous post on this topic.

2) If you use mod_proxy you can give it the same web root and have it serve
   some static objects itself instead of having to cache them. But 1) is even
   better than doing this. Sometimes you might not have a choice, such as with
   java applets.

3) mod_proxy is poorly designed and poorly implemented. The main deficiency is
   that each process is responsible for opening and maintaining its connection
   to the backend. This defeats keep-alives completely and forces a lot of
   overhead in the kernel and the servers.
 
   There's a much better design that involves creating a fixed number of
   sockets and treating that as a shared pool. In that design the backend can
   have a long keep-alive timeout and maintain persistent connections to the
   front-end. 


Despite these concerns I've been using mod_proxy myself and it does work. I'm
planning to change to mod_backhand though which implements 3) but it's new
code.

-- 
greg




Re: Killing off children

2000-04-13 Thread Greg Stark


What state was the process in?

There are only two states that a process can be in that won't respond to -9:

Zombie (Z in ps), in which case the process is already dead and Apache didn't wait on 
it
properly. This isn't a problem just ignore it unless you can reproduce it in
which case report it as an Apache bug.

Disk wait (D in ps), which is actually any uninterruptible sleep, usually disk
i/o, indicates either something is broken in your kernel or that you're using
NFS. 

In the case of disk wait you can actually get the wait channel from ps and
look it up in your kernel symbol table to find out what resource it was
waiting on. What you would do with that information isn't clear though. I
suppose it might point the way to what component of the system was misbehaving
if the problem occurred frequently.

Bill Moseley [EMAIL PROTECTED] writes:

 Yes, a system problem, I guess, if kill -9 doesn't work I'm not sure what
 will work.  I tried a truss, but it reported "truss: cannot control process
 3732" which I assume is because it's parent is root, and my cgi was running
 as nobody.

root should be able to truss any process other than init. I suspect this
message meant the process was actually a zombie and not really alive at all.

-- 
greg




Re: Caching DBI handles with IPC?

2000-02-08 Thread Greg Stark


Saar Picker [EMAIL PROTECTED] writes:

 Thanks for responding. We currently are cacheing DB connections
 per-process. However, with 40-50 processes per server, and 4+ machines per
 DB server, and 3-5 connections per process, you can see how the number of
 connections per DB server gets rather large. I think the problem lies
 with the CODE references. I'll check out IPC::Shareable some more.

Firstly your numbers sound a little odd, 

a) why do you have more than one connection per process, I assume you're using
connection persistent connections of some sort (look at connect_cached for
example)

b) Why do you run as many as 50 processes, if you split off all the static
data onto a separate server you might find things run as fast or faster with
fewer processes. 

c) 100-200 connections might not be out of line for your database. If you're
using Oracle you might check into MTS for example which can handle 1000+
connections as easily as 1 connection if they're not doing any more database
work.

Your problems sharing connections across sessions has nothing to do with perl.
A database connection is more than just perl code, it's usually network socket
and it's usually managed by a C library from the database vendor. Worse, most
databases if not all databases tie the concept of session to the network
connection. If two processes end up writing to the same socket the database
will be very confused.

In any case you can't store a socket in a shared memory segment, it's not just
a piece of data. You would need to arrange to open all your sockets before
Apache forked or find some other way to distribute them. 

Then you would need to deal with the fact that your database library stores
some state information that would also need to be shared, either putting all
of that in shared memory or some other way. And you don't have access to it in
perl, you would need to do this in the DBD driver's C code and either use
explicit support from the library or add code to the low level DB library. 

Then you would need to write the perl layer to handle locking the handles to
avoid having two processes trying to use the same handle at the same time.

In other words, there's a lot of work to be done to do this using shared
memory, and not all the libraries would even support it. I'm not completely
sure any of them would.

DBI::Proxy works by having a single process do all the database work,
everything else talks to the proxy. This adds a layer of latency though.
Oracle has a native tool called Connection Manager that does something
similar. 

-- 
greg



Re: Apache::Session, DBD::Oracle

2000-02-08 Thread Greg Stark


[EMAIL PROTECTED] (Robert Locke) writes:

   - store this string into Oracle  (type is LONG)

You really really don't want to be using LONG btw. How large is the data
you're really storing anyways? Oracle can do varchars up to 2k unlike some
other pesky databases.

LONGs have a number of problems, you can't export/import them, you can't
create table as select to copy them to a new table etc. They also allegedly
make your tables slow to access, though I don't know the details. I don't know
if BLOBs are any different though. 

I do wonder whether you're making good use of your database to be storing
information as frozen perl data structures. It's flexible but it can't be very
fast and it doesn't buy you the data mining abilities having a database is
good for.

-- 
greg



Re: squid performance

2000-01-29 Thread Greg Stark


Leslie Mikesell [EMAIL PROTECTED] writes:

 I agree that it is correct to serve images from a lightweight server
 but I don't quite understand how these points relate.  A proxy should
 avoid the need to hit the backend server for static content if the
 cache copy is current unless the user hits the reload button and
 the browser sends the request with 'pragma: no-cache'.

I'll try to expand a bit on the details:

  1) Netscape/IE won't intermix slow dynamic requests with fast static requests
 on the same keep-alive connection
 
 I thought they just opened several connections in parallel without regard
 for the type of content.

Right, that's the problem. If the two types of content are coming from the
same proxy server (as far as NS/IE is concerned) then they will intermix the
requests and the slow page could hold up several images queued behind it. I
actually suspect IE5 is cleverer about this, but you still know more than it
does.

By putting them on different hostnames the browser will open a second set of
parallel connections to that server and keep the two types of requests
separate.

  2) static images won't be delayed when the proxy gets bogged down waiting on
 the backend dynamic server.

Picture the following situation: The dynamic server normally generates pages
in about 500ms or about 2/s; the mod_perl server runs 10 processes so it can
handle 20 connections per second. The mod_proxy runs 200 processes and it
handles static requests very quickly, so it can handle some huge number of
static requests, but it can still only handle 20 proxied requests per second.

Now something happens to your mod_perl server and it starts taking 2s to
generate pages. The proxy server continues to get up to 20 requests per second
for proxied pages, for each request it tries to connect to the mod_perl
server. The mod_perl server can now only handle 5 requests per second though.
So the proxy server processes quickly end up waiting in the backlog queue. 

Now *all* the mod_proxy processes are in "R" state and handling proxied
requests. The result is that the static images -- which under normal
conditions are handled quicly -- become delayed until a proxy process is
available to handle the request. Eventually the backlog queue will fill up and
the proxy server will hand out errors.

 This is a good idea because it is easy to move to a different machine
 if the load makes it necessary.  However, a simple approach is to
 use a non-mod_perl apache as a non-caching proxy front end for the
 dynamic content and let it deliver the static pages directly.  A
 short stack of RewriteRules can arrange this if you use the 
 [L] or [PT] flags on the matches you want the front end to serve
 and the [P] flag on the matches to proxy.

That's what I thought. I'm trying to help others avoid my mistake :)

Use a separate hostname for your pictures, it's a pain on the html authors but
it's worth it in the long run.
-- 
greg



Re: squid performance

2000-01-29 Thread Greg Stark

Leslie Mikesell [EMAIL PROTECTED] writes:

 The 'something happens' is the part I don't understand.  On a unix
 server, nothing one httpd process does should affect another
 one's ability to serve up a static file quickly, mod_perl or
 not.  (Well, almost anyway). 

Welcome to the real world however where "something" can and does happen.
Developers accidentally put untuned SQL code in a new page that takes too long
to run. Database backups slow down normal processing. Disks crash slowing down
the RAID array (if you're lucky). Developers include dependencies on services
like mail directly in the web server instead of handling mail asynchronously
and mail servers slow down for no reason at all. etc.

  The proxy server continues to get up to 20 requests per second
  for proxied pages, for each request it tries to connect to the mod_perl
  server. The mod_perl server can now only handle 5 requests per second though.
  So the proxy server processes quickly end up waiting in the backlog queue. 
 
 If you are using squid or a caching proxy, those static requests
 would not be passed to the backend most of the time anyway. 

Please reread the analysis more carefully. I explained that. That is
precisely the scenario I'm describing faults in.

-- 
greg



Re: squid performance

2000-01-20 Thread Greg Stark


Vivek Khera [EMAIL PROTECTED] writes:

 Squid does indeed cache and buffer the output like you describe.  I
 don't know if Apache does so, but in practice, it has not been an
 issue for my site, which is quite busy (about 700k pages per month).
 
 I think if you can avoid hitting a mod_perl server for the images,
 you've won more than half the battle, especially on a graphically
 intensive site.

I've learned the hard way that a proxy does not completely replace the need to
put images and other other static components on a separate server. There are
two reasons that you really really want to be serving images from another
server (possibly running on the same machine of course).

1) Netscape/IE won't intermix slow dynamic requests with fast static requests
   on the same keep-alive connection

2) static images won't be delayed when the proxy gets bogged down waiting on
   the backend dynamic server.

Both of these result in a very slow user experience if the dynamic content
server gets at all slow -- even out of proportion to the slowdown. 

Eg, if the dynamic content generation becomes slow enough to cause a 2s
backlog of connections for dynamic content, then a proxy will not protect the
static images from that delay. Netscape or IE may queue those requests after
another dynamic content request, and even if they don't the proxy server will
eventually have every slot taken up waiting on the dynamic server. 

So *every* image on the page will have another 2s latency, instead of just a
2s latency for the entire page. This is worst in Netscape of course course
where the page can't draw until all the images sizes are known.

This doesn't mean having a proxy is a bad idea. But it doesn't replace putting
your images on pics.mydomain.foo even if that resolves to the same address and
run a separate apache instance for them.

-- 
greg



Re: squid performance

2000-01-20 Thread Greg Stark


"G.W. Haywood" [EMAIL PROTECTED] writes:

 Would it be breaching any confidences to tell us how many
 kilobyterequests per memorymegabyte or some other equally daft
 dimensionless numbers?

I assume the number you're looking for is an ideal ratio between the proxy and
the backend server? No single number exists. You need to monitor your system
and tune. 

In theory you can calculate it by knowing the size of the average request, and
the latency to generate an average request in the backend. If your pages take
200ms to generate, and they're 4k on average, then they'll take 1s to spool
out to a 56kbs link and you'll need a 5:1 ratio. In practice however that
doesn't work out so cleanly because the OS is also doing buffering and because
it's really the worst case you're worried about, not the average.

If you have the memory you could just shoot for the most processes you can
handle, something like 256:32 for example is pretty aggressive. If your
backend scripts are written efficiently you'll probably find the backend
processes are nearly all idle.

I tried to use the minspareservers and maxspareservers and the other similar
parameters to let apache tune this automatically and found it didn't work out
well with mod_perl. What happened was that starting up perl processes was the
single most cpu intensive thing apache could do, so as soon as it decided it
needed a new process it slowed down the existing processes and put itself into
a feedback loop. I prefer to force apache to start a fixed number of processes
and just stick with that number.

-- 
greg



Re: oracle : The lowdown

2000-01-19 Thread Greg Stark


Matt Sergeant [EMAIL PROTECTED] writes:

 Depends what the business is. If it is a serious business looking for VC I
 would actually suspect the inverse is true: MySQL is underkill (I think I
 just made that word up) due to its lack of transactions and other advanced
 features (yes, these things do mean something in the real world).

Actually for web sites the lack of transactions is more of a boon than a
problem. Carefully written web pages rarely need complex multiple query
transactions anyways. I'm using Oracle now and the single biggest complaint is
the unnecessary overhead transactions put in everything even when they're not
needed or wanted.

For example, it makes it very hard to mix any kind of long running query with
OLTP transactions against the same data, since rollback data accumulates very
quickly. I would give some appendage for a while to tell Oracle to just use
the most recent data for a long running query without attempting to rollback
to a consistent view.

That said other Oracle features are absolutely essential to web sites:
partitioned tables, warm standby databases, hot backups, etc. 

-- 
greg



Re: ASP Cookieless Sessions (WAS Re: Apache::ASP)

2000-01-02 Thread Greg Stark


Joshua Chamas [EMAIL PROTECTED] writes:

 It reoccured to me just now (back from a sessions methods discussion a long
 time ago) that these query string cookies might show up in the referer logs
 of other sites if you have offsite links on your session id pages. I tried a
 workaround just now where a redirect program would handle offsite links, but
 the HTTP_REFERER is sticky to the last page visited, and I see no workaround
 to this security issue.

Instead of redirecting them offsite present a page saying "you're about to go
offsite" and use a refresh meta tag to send them on their way. If you set the
timeout on the refresh to 0 they won't even see the page and I would expect
the referrer to still be set. You might even be able to use a refresh header
instead of a meta tag and just use a static html page.

-- 
greg



Re: mod_perl-1.21 and apache-1.3.9

1999-11-08 Thread Greg Stark


I don't think it was Apache's DSO support that was broken, I had httpd working
just fine with dynamic everything except mod_perl. mod_perl worked usually but
seg faulted with one obscure xs package. I think other similar problems have
been observed too.

In this case though I think the problem is that he's using the Red Hat binary
perl packages, which are known to be bogus. I'm not sure what Red Hat does to
their perl but it doesn't work right.

hUnTeR [EMAIL PROTECTED] writes:

 Rasmus Lerdorf wrote:
  
  As of Apache-1.3.9, Apache's DSO support really should be stable.  I am
  running a bunch of servers with the DSO version of the PHP module without
  any problems.
  
  -Rasmus
 
 I am as well. I have 5 other redhat 6.1 servers running apache-1.3.9
 with mod_ssl, mod_perl, openssl, and php and they all run fantastic. But
 its just this one redhat 5.2 server thats giving me headaches.

-- 
greg



Re: Problems building

1999-11-08 Thread Greg Stark


Has nobody seen these problems? It seems strange, I had no trouble building
1.3.4+1.19 on Solaris but this is a fresh build on Linux with 1.3.9+1.21 and
these errors don't seem to be configuration dependent, they look like generic
problems with the build system. What could be wrong?

Greg Stark [EMAIL PROTECTED] writes:

 I'm trying to update to 1.3.9+1.21 but I'm having various problems:
 
 1) The makefile seems to try to run ../apaci even though perl is two levels
deep, so it can't find ../apaci, it would have to be ../../apaci
 
 === src/modules/perl
 gcc -I. -I../../include -I../../include/regex -I../../include/.././os/unix -DLINUX=2 
-DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite `../apaci`  `/data/app/perl/bin/perl 
-MExtUtils::Embed -e ccopts`   -DNO_PERL_RESTART   
-DMOD_PERL_VERSION=\"1.21\"  -I./os/unix -I../../include -c mod_perl_opmask.c -o 
mod_perl_opmask.o
 /bin/sh: ../apaci: No such file or directory
 
 2) when it tries to link it gets pages and pages of these errors:
 
 gcc  -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite `./apaci`\
   -o httpd buildmark.o modules.o modules/perl/libperl.a 
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a 
regex/libregex.a lib/expat-lite/libexpat.a  -lm -lcrypt
 modules/perl/libperl.a(mod_perl.o): In function `perl_shutdown':
 mod_perl.o(.text+0xf8): undefined reference to `PL_perl_destruct_level'
 mod_perl.o(.text+0x102): undefined reference to `PL_perl_destruct_level'
 mod_perl.o(.text+0x10c): undefined reference to `PL_perl_destruct_level'
 mod_perl.o(.text+0x13b): undefined reference to `Perl_av_undef'
 mod_perl.o(.text+0x149): undefined reference to `Perl_sv_free'
 mod_perl.o(.text+0x161): undefined reference to `Perl_av_undef'
 
 
 3) Once I got it to build the httpd segfaulted whenever it got a request.
 
 Needless to say I'm a bit frustrated :(
 
 -- 
 greg
 

-- 
greg



Re: Memory problems

1999-11-03 Thread Greg Stark


[EMAIL PROTECTED] writes:

 Thanks Greg
 
  I strongly suggest you move the images to a separate hostname
  altogether. The
  proxy is a good idea but there are other useful effects of
  having a separate
  server altogether that I plan to write about in a separate
  message sometime.
  This does mean rewriting all your img tags though.
 
 Look forward to that with interest

Briefly the reason you want a separate server and not just a proxy is because
netscape and other browsers can do requests in parallel more efficiently. If
they're on the same server the browser might choose to queue up a bunch of
image downloads on the same connection using keepalives. If it orders them
with the slow script generated page first then they get delayed by the length
of time it takes the script engine to run.

Also if you end up with a backlog queue of proxy servers waiting for a script
engine to service them then all your proxy server processes can get stuck
waiting for a script engine process. That's fine if all they do is serve
dynamic pages but not if they're also responsible for serving static objects.

The proxy server may still be useful but it doesn't replace using a separate
server on a different hostname or port for the images and static documents.
Besides you may eventually want to do that anyways and it will be easier if
you've been doing it all along.

 I have two PIII 500's, so CPU usage is no problem.  Amazingly, it's the 1Gig
 of memory which expires first.

That sounds like you have some high-latency job being handled by your perl
server. Are they sending mail? Or doing database accesses into a database that
can't keep up? If it's just perl it would only take a handful to use 100% cpu,
they must be idle waiting for something.

I agree with the [EMAIL PROTECTED], if you have to do anything at all
dependent on external i/o like sending mail you want to queue up the events
and handle them asynchronously. Anything that can arbitrarily increase the
latency off the perl httpds is a disaster waiting to happen.

Gee, I think I just summarized the two big lessons I was going to write about
in the same vein as jb's "in practice" message. I've learned these lessons the
hard way, hopefully we can build enough of a repertoire of such lessons in the
FAQ to help other people avoid this :)

-- 
greg



Problems building

1999-11-03 Thread Greg Stark


I'm trying to update to 1.3.9+1.21 but I'm having various problems:

1) The makefile seems to try to run ../apaci even though perl is two levels
   deep, so it can't find ../apaci, it would have to be ../../apaci

=== src/modules/perl
gcc -I. -I../../include -I../../include/regex -I../../include/.././os/unix -DLINUX=2 
-DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite `../apaci`  `/data/app/perl/bin/perl 
-MExtUtils::Embed -e ccopts`   -DNO_PERL_RESTART   
-DMOD_PERL_VERSION=\"1.21\"  -I./os/unix -I../../include -c mod_perl_opmask.c -o 
mod_perl_opmask.o
/bin/sh: ../apaci: No such file or directory

2) when it tries to link it gets pages and pages of these errors:

gcc  -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite `./apaci`\
  -o httpd buildmark.o modules.o modules/perl/libperl.a 
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a 
regex/libregex.a lib/expat-lite/libexpat.a  -lm -lcrypt
modules/perl/libperl.a(mod_perl.o): In function `perl_shutdown':
mod_perl.o(.text+0xf8): undefined reference to `PL_perl_destruct_level'
mod_perl.o(.text+0x102): undefined reference to `PL_perl_destruct_level'
mod_perl.o(.text+0x10c): undefined reference to `PL_perl_destruct_level'
mod_perl.o(.text+0x13b): undefined reference to `Perl_av_undef'
mod_perl.o(.text+0x149): undefined reference to `Perl_sv_free'
mod_perl.o(.text+0x161): undefined reference to `Perl_av_undef'


3) Once I got it to build the httpd segfaulted whenever it got a request.

Needless to say I'm a bit frustrated :(

-- 
greg



Re: Failing to reconnect after Oracle shutdown abort (Apache::DBI)

1999-11-03 Thread Greg Stark


Jeffrey Baker [EMAIL PROTECTED] writes:

 That's what the driver handle's ping method is for.
 
 if (!$dbh-ping) { reconnect; }

I suppose I could do a ping before every page, but really that's only a kludgy
work-around. Really I would want to do this before every single query, and the
right way to do that is to check every call for errors and handle
those that indicated connection problems by reconnecting. Introducing extra
traffic to do this is a waste.

Unfortunately Oracle doesn't seem to return any one specific error when
disconnected. I've seen a lot of "TNS can't resolve name" type errors (I
forget the number, sorry) and a lot of "hostdef extension not found" which
oerr says is an internal error and indicates a library bug :)

-- 
greg



Re: Failing to reconnect after Oracle shutdown abort (Apache::DBI)

1999-11-02 Thread Greg Stark


Tim Bunce [EMAIL PROTECTED] writes:

 Has anyone experienced a situation where a process (httpd for example)
 can't reconnect to Oracle after a "shutdown abort"?
 
 Tim.

As far as I can tell we never get a clean reconnection after any sort of
connection problem. I don't even think it takes a shutdown abort to cause
this.

-- 
greg



Re: Memory problems

1999-11-02 Thread Greg Stark


Stas Bekman [EMAIL PROTECTED] writes:

  I had huge problems yesterday.  Our web site made it in to the Sunday
  Times and has had to serve 1/2 million request in the last 2 days.
 
 Oh, I thought there was a /. effect, now it's a sunday effect :)

The original concept should be credited to Larry Niven, he called the effect
"Flash crowds"

  Had I set it up to have proxy servers and a separate mod_perl server?
  No.  DOH!  So what happened to my 1Gig baby? It died. A sad and unhappy
  death.

I strongly suggest you move the images to a separate hostname altogether. The
proxy is a good idea but there are other useful effects of having a separate
server altogether that I plan to write about in a separate message sometime.
This does mean rewriting all your img tags though.

  What happened was this:  My memory usage went up and up until I got "Out
  of memory" messages MySQL bailed out.  Memory usage was high, and the
  server was swapping as well.  
 
  So I thought - restart MySQL and restart Apache.  But I couldn't reclaim
  memory.  It was just unavailable.  How do you reclaim memory other than
  by stopping the processes or powering down?  Is this something that
  might have happened because it went past the Out of Memory stage?

Have you rebooted yet? Linux has some problems recovering when you run out of
memory really badly. I haven't tried debugging but our mail exchangers have
done some extremely wonky things once they ran out of memory even once
everything had returned to normal. Once non-root users couldn't fork, they
just got "Resource unavailable" but root was fine and memory usage was low.

 First, what you had to do in first place, is to set MaxClients to
 such a number, that when you take the worst case of the process growing to
 X size in memory, your machine wouldn't swap. Which will probably return
 an Error to some of the users, when processes would be able to queue all
 the requests, but it would never keep your machine down!

I claim MaxClients should only be large enough to force 100% cpu usage whether
from your database or the perl script. There's no benefit to having more
processes running if they're just context switching and splitting the same
resources finer. Better to queue the users in the listen queue.

On that note you might want to set the BackLog parameter (I forget the precise
name), it depends on whether you want users to wait indefinitely or just get
an error.

-- 
greg



Re: setting cookies?

1999-11-02 Thread Greg Stark


I think if you send a 401 in response to a request that contained auth data
the user will typically see a "Authentication failed" box, which may look bad
compared to just getting the password dialog.

Actually I couldn't get this to work a while back, but I didn't try very hard.


"Andrei A. Voropaev" [EMAIL PROTECTED] writes:

 On Mon, Nov 01, 1999 at 05:03:58PM -0500, Robin Berjon wrote:
  I've never tried this but doesn't sending two 401s in a row for the same
  document have the auth popup appear again ?
 
 I feel like this topic gets slightly confusing. Browser sends request,
 gets 401 back, asks user for username and password if it doesn't have
 one cached already. If it has one cached for this particular realm
 then it attempts to send the cached values. If in response it gets 401
 again then it asks user for new username and password for this realm.
 As far as I know it always takes 2 requests to get protected
 document. First one returns with 401 code and realm for authentication,
 second request is done with appropriate user name and password.
 
 So if for some reason you decide that some user name and password is
 not valid any more then you should make sure that if they are sent any
 number of  times later then your authentication handler says no
 always.
 
 Andrei
 
 -- 
 

-- 
greg



Re: Failing to reconnect after Oracle shutdown abort (Apache::D BI)

1999-11-02 Thread Greg Stark


"Young, Geoffrey S." [EMAIL PROTECTED] writes:
 
 Incidentally, I have also noticed that on my Linux installation Oracle will
 not shutdown (or shutdown abort) while any of the httpd processes have
 persistent connections.  That is, httpd must come down first for Oracle to
 shutdown cleanly.  Just thought I'd mention it...

There are different kinds of shutdowns

shutdown - waits for every connection to disconnect
shutdown immediate - cleans up partially executed transactions
shutdown abort - leaves dirty blocks on disk which get cleaned up as needed

Shutdown immediate can take a while to execute but shutdown abort should be
fast. According to people on comp.databases.oracle.server unless you plan to
do a backup you can just use shutdown abort. A plain shutdown is useless for
web server databases unless you shut down every client including the web
server first, and even then it doesn't always seem to work.

In our experience pmon sometimes goes wonky if you shutdown abort and then
bring the database up. Tech support told us to shutdown abort, bring up the
database, then shutdown immediate and bring it up again. The second shutdown
cleans up the dirty blocks. I'm not sure if this is just superstition or
actually helps but that's what we do now.

-- 
greg



Re: Problem setting up mod_proxy_add_forward

1999-11-01 Thread Greg Stark


Where was the proxy_add_forward patch again?

-- 
greg



Re: Problem setting up mod_proxy_add_forward

1999-11-01 Thread Greg Stark


Vivek Khera [EMAIL PROTECTED] writes:

  "GS" == Greg Stark [EMAIL PROTECTED] writes:
 
 GS Where was the proxy_add_forward patch again?
 
 It ain't a patch, its a module.  The Apache module registry has a
 pointer to it.

Thanks, so where would I find this Apache module registry? It doesn't seem to
be linked to off apache.org anywhere.

-- 
greg



Profiling

1999-10-31 Thread Greg Stark


Does anyone have any idea how much overhead Apache::DProf or Apache::SmallProf
add? Will it be possible to use these on a production system without having a
severe impact?

And has anyone used DBIx::Profile with mod_perl ? All I keep getting is:
 Can't locate object method "printProfile" via package "DBI::db" at (eval 35) line 4.

I can't figure out if this is due to the way i'm loading modules or calling
connect or what. I think I've removed all references to Apache::DBI and even
made it avoid doing a "use DBI" in case that interferes, but it still does
this.

-- 
greg



Re: How to know PID of DB backend ?

1999-10-30 Thread Greg Stark


Oleg Bartunov [EMAIL PROTECTED] writes:

 Using ApacheDBI I keep persistent connections between
 httpd and db. Now I want to know PIDs of httpd children and
 database backend. For the httpd it's trivial but I don't
 know where to get PID of db backend.
 
   Regards,
   Oleg

That would be entirely dependent on your database, not all databases even
start subprocesses. What database are you using?

-- 
greg



Re: Another IE5 complaint

1999-10-02 Thread Greg Stark


"Joe Pearson" [EMAIL PROTECTED] writes:

 Hi all,
 
 Maybe everyone already knows this, but I just discovered that
 whenever a IE5 user visits a page in their "Favorites", IE5 also trys
 to GET favicon.ico from the same site.  Therefor I have hundreds of
 "File does not exist:"  errors in my log file.

I noticed this a while ago, but I don't see how this is a problem. It's not
like returning 404's is really that big a deal for the server. The privacy
issues of broadcasting to the server whenever the user sets a favourite is
perhaps a bit worrisome though.

Can the gimp save .ico files? How big and what colours etc does IE5 expect
these to be anyways?

-- 
greg



Re: XML and Apache

1999-01-03 Thread Greg Stark



There was a database posted on freshmeat specifically designed for storing XML
data. I'm not sure what that would mean but perhaps it would be the solution
for your problem?

"Anthony Gardner" [EMAIL PROTECTED] writes:

 All,
 
 I have a problem.
 
 I want to use data in XML format and store it in memory for obvious reasons 
 of speed and to utilise the capabilities of XML. I also want to load the 
 data at server start up time.
 
 The problem arises with the size of the data. I end up with six children 
 each with 150MB of data. Needless to say I've run out of memory and the 
 error_log gives error msgs about not being able to fork.

-- 
greg