Does Abyss X1 support the HTTP OPTIONS request?

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Thissa
-


Joined: 14 Jun 2003
Posts: 7

PostPosted: Sun Feb 10, 2008 8:54 am    Post subject: Does Abyss X1 support the HTTP OPTIONS request? Reply with quote

Question: Does Abyss Web Server X1, version 2.5, support the OPTIONS request of the HTTP 1.1 protocol? (as opposed to GET/POST)...

Background: I have two instances of Abyss X1, with each one running on a different machine. I also have a third machine which is running the Perlbal load balancing software. Client requests will be sent to Perlbal, which are then (in theory) passed to the least loaded instance of Abyss X1, allowing my web application to scale and handle more users.

One of the options in Perlbal, "verify_backend", is described as follows:
Quote:
Whether Perlbal should send a quick OPTIONS request to the backends before sending an actual client request to them. If your backend is Apache or some other process-based webserver, this is HIGHLY recommended. All too often a loaded backend box will reply to new TCP connections, but it's the kernel's TCP stack Perlbal is talking to, not an actual Apache process yet. Using this option reduces end-user latency a ton on loaded sites.

When I enable this option, Perlbal just times out instead of passing the request to Abyss. I am told this is because of a lack of support for the OPTIONS request, however I could be mistaken. Also, I'm not sure what they mean by a "process-based webserver", perhaps I don't even need to enable this option for Abyss?

Further background info: For a university term project, me and a couple classmates are building a distributed day-trading system consisting of several Postgresql databases, custom-written C transaction servers, and Abyss web nodes. We have one lab of 20 Linux machines at our disposal, and to pass the project the overall system has to scale to a load of 1,000 users. If anyone has any optimization tips, I'm all ears :)
Back to top View user's profile Send private message
pkSML
-


Joined: 29 May 2006
Posts: 955
Location: Michigan, USA

PostPosted: Sat Feb 16, 2008 12:47 pm    Post subject: Reply with quote

I have this line in a logfile.
Code:
192.168.1.150 - - [07/Apr/2005:08:35:33 -0400] "OPTIONS / HTTP/1.1" 200 1387 "" "Microsoft-WebDAV-MiniRedir/5.1.2600"

So I made a simple PHP script to test it out.
Code:
<?php
$fp = fsockopen("192.168.1.120", 80, $errno, $errstr, 10);
if (!$fp) {
    echo "<h1>ERROR</h1><HR>$errstr ($errno)<br />\n";
} else {
    $out = "OPTIONS / HTTP/1.1\r\n";
//    $out .= "Host: 192.168.1.120\r\n";
    $out .= "Connection: Close\r\n\r\n";

    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?>


Turns out, Abyss seems to interpret this as GET /
It gives me my default host homepage, complete with the HTTP headers.

I'm sure Aprelium will weigh in with more technical details here.

As for speeding up Abyss, see this rather lengthly post --> http://www.aprelium.com/forum/viewtopic.php?t=14766
_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Feb 25, 2008 4:37 pm    Post subject: Re: Does Abyss X1 support the HTTP OPTIONS request? Reply with quote

Thissa,

OPTIONS is supported on Abyss Web Server. But all depends on where you apply it:

If OPTIONS is applied to a directory or a static file, Abyss Web Server will reply with:

Code:
HTTP/1.1 200 OK
Connection: Close
Date: Mon, 25 Feb 2008 15:33:52 GMT
Server: Abyss/2.5.0.0-X2-Win32 AbyssLib/2.5.0.0
Allow: HEAD, GET


If you send OPTIONS to a script, it is passed to the script and the response will depend on how the script handles that verb. In most cases, scripts are not aware of OPTIONS and will process it as a simple GET. If a script is to be OPTIONS aware, it has to test the HTTP verb and return an Allow header (as above) containing the verbs it supports (HEAD, GET, POST, etc...).
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Thissa
-


Joined: 14 Jun 2003
Posts: 7

PostPosted: Mon Mar 10, 2008 11:02 pm    Post subject: Reply with quote

Okay, after a few weeks of scratching my brain, I've got a solution. I'm not sure if the fault likes with Perlbal or Abyss, but here's a workaround:

1) Install version 1.70 or greater of Perlbal, and make sure the following line is in your configuration file:
Code:
SET verify_backend_path = /

This makes Perlbal send "OPTIONS / HTTP/1.0" instead of the default "OPTIONS * HTTP/1.0". (Abyss doesn't support the * like Apache does).
Note: I actually use /pages/ instead of / to trigger a directory instead of a PHP script which would treat the OPTIONS request as a GET.

2) In Perlbal's source, in line 353 of BackendHTTP.pm, change the line from this:
Code:
            $self->write("OPTIONS " . $self->{service}->{verify_backend_path} . " HTTP/1.0\r\nConnection: keep-alive\r\n\r\n");

to this:
Code:
            $self->write("OPTIONS " . $self->{service}->{verify_backend_path} . " HTTP/1.0\r\n\r\n");

For some reason sending Connection:keep-alive doesn't seem to work right.

Here's a comparison between Apache and Abyss's responses to OPTIONS:

Apache, "OPTIONS * HTTP/1.0\r\nConnection:keep-alive\r\n\r\n" (this works):
Code:
HTTP/1.1 200 OK
Date: Mon, 10 Mar 2008 21:55:57 GMT
Server: Apache/2.0.52 (Red Hat)
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 0
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/plain; charset=ISO-8859-1


Abyss, "OPTIONS /pages/ HTTP/1.0\r\nConnection:keep-alive\r\n\r\n" (this doesn't work, the connection is NOT kept alive despite what is said, and Perlbal times out):
Code:
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=150000, max=10
Date: Mon, 10 Mar 2008 21:57:48 GMT
Server: Abyss/2.5.0.0-X1-Linux AbyssLib/2.5.0.0
Allow: HEAD, GET


Abyss, "OPTIONS /pages/ HTTP/1.0\r\n\r\n" (this works, despite connection not being kept alive):
Code:
HTTP/1.1 200 OK
Connection: Close
Date: Mon, 10 Mar 2008 22:00:05 GMT
Server: Abyss/2.5.0.0-X1-Linux AbyssLib/2.5.0.0
Allow: HEAD, GET


Abyss, "OPTIONS * HTTP/1.0\r\nConnection:keep-alive\r\n\r\n":
This closes the connection after the first newline without returning anything at all.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Mar 19, 2008 7:00 pm    Post subject: Reply with quote

Thissa,

Again here the difference is that Apache is answering instead of the script and pretends it handles GET/POST/etc.. Apache does not know if the script can handle POST (it is just an assumption and scripts can be written in a way to not handle POST). Abyss does not do the same and passes the request to the script itself. That's the best way to handle the query and makes sense since the script only knows what it supports and what it doesn't.

Keep-alive is also not honored because you are sending a HTTP/1.0 request. The HTTP standard explains very well that Keep-alive is only for HTTP/1.1 clienst and servers may ignore it when discussing with HTTP/1.0 clients.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group