MogileFs + Perlbal as Reproxy + Java Client

Oezcan Acar acar at unitedinter.net
Tue May 1 19:50:40 UTC 2007


Hi,

I managed to get some debug output. As you can see, Perlbal gets with X-REPROXY-URL the location of the file and is able to request the file from mogstored. Mogstored delivers the file to perlbal, but the .gif file is never displayed in clients browser.

Can someone help figure out, what the problem here is?


thanks.



Perlbal debug output:

______________________________________

Got new conn: IO::Socket::INET=GLOB(0x81924c0) (213.221.93.222:63280) for reverse_proxy
ClientProxy::event_read
  no headers.  reading.
Perlbal::Socket::read_headers(Perlbal::ClientProxy=ARRAY(0x8192424)) is_res=0
  client disconnected
Got new conn: IO::Socket::INET=GLOB(0x87ad91c) (213.221.93.221:47966) for reverse_proxy
ClientProxy::event_read
  no headers.  reading.
Perlbal::Socket::read_headers(Perlbal::ClientProxy=ARRAY(0x87ad700)) is_res=0
  client disconnected
Got new conn: IO::Socket::INET=GLOB(0x819243c) (213.221.93.250:12019) for reverse_proxy
ClientProxy::event_read
  no headers.  reading.
Perlbal::Socket::read_headers(Perlbal::ClientProxy=ARRAY(0x87ad700)) is_res=0
  pre-parsed headers: [GET /getfile.jsp?k=amazon HTTP/1.1
Accept: */*
Accept-Language: de
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Host: image.bizimalem.com
Connection: Keep-Alive
Cookie: nickname=sendmail; FZIYO=0a08ecf43dd4831085e9c974d59caaef; TIMZTI=ea3c505e343ae995b0b7ee3ede4ebf29; LANG=tr; JSESSIONID=amoKXjwlIG-f]
  got valid headers
Backend Perlbal::BackendHTTP=ARRAY(0x87adc4c) is writeable!
Backend requesting client, got normal = 3.
write(Perlbal::BackendHTTP=ARRAY(0x87adc4c), <449>"GET /getfile.jsp?...") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 290)
write(Perlbal::BackendHTTP=ARRAY(0x87adc4c), <15>"CODE(0x87ae258)") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 300)
Backend Perlbal::BackendHTTP=ARRAY(0x87adc4c) is readable!
Perlbal::Socket::read_headers(Perlbal::BackendHTTP=ARRAY(0x87adc4c)) is_res=1
  pre-parsed headers: [HTTP/1.0 200 OK
Server: Resin/2.1.17
Vary: Accept-Encoding
Content-Encoding: gzip
Cache-Control: must-revalidate
X-REPROXY-URL: http://213.221.93.230:7500/dev1/0/000/000/0000000018.fid
Content-Type: image/gif
Date: Tue, 01 May 2007 19:34:21 GMT]
  pushing back 21 bytes after header
  got valid headers
BackendHTTP: handle_response
Backend Perlbal::BackendHTTP=ARRAY(0x87ba02c) is writeable!
write(Perlbal::BackendHTTP=ARRAY(0x87ba02c), <98>"GET /dev1/0/000/0...") from (Perlbal::ClientProxy, lib/Perlbal/ClientProxy.pm, 244)
Backend Perlbal::BackendHTTP=ARRAY(0x87ba02c) is writeable!
Use of uninitialized value in concatenation (.) or string at lib/Perlbal/Socket.pm line 74.
write(Perlbal::BackendHTTP=ARRAY(0x87ba02c), <undef>"") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 366)
Backend Perlbal::BackendHTTP=ARRAY(0x87ba02c) is readable!
Perlbal::Socket::read_headers(Perlbal::BackendHTTP=ARRAY(0x87ba02c)) is_res=1
  pre-parsed headers: [HTTP/1.0 200 OK
Date: Tue, 01 May 2007 19:34:21 GMT
Server: Perlbal
Last-Modified: Sun, 29 Apr 2007 11:10:49 GMT
Accept-Ranges: bytes
Content-Type: text/plain
Content-Length: 1326
Connection: keep-alive
Keep-Alive: timeout=30, max=100]
  pushing back 1326 bytes after header
  got valid headers
BackendHTTP: handle_response
ClientHTTPBase::setup_keepalive(Perlbal::ClientProxy=ARRAY(0x87ad700))
  service's persist_client = 1
  doing connection: close
  writing response headers to client
write(Perlbal::ClientProxy=ARRAY(0x87ad700), <223>"HTTP/1.0 200 OK
...") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 507)
  content_length=1326  remain=1326
Backend Perlbal::BackendHTTP=ARRAY(0x87ba02c) is readable!
write(Perlbal::ClientProxy=ARRAY(0x87ad700), <1326>"GIF89adÕÿÚ¤Ë...") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 562)
write(Perlbal::ClientProxy=ARRAY(0x87ad700), <15>"CODE(0x87ba380)") from (Perlbal::BackendHTTP, lib/Perlbal/BackendHTTP.pm, 573)
ClientProxy::backend_finished
Got new conn: IO::Socket::INET=GLOB(0x87ae2c4) (213.221.93.222:63312) for reverse_proxy
ClientProxy::event_read
  no headers.  reading.
Perlbal::Socket::read_headers(Perlbal::ClientProxy=ARRAY(0x87ad700)) is_res=0
  client disconnected
Got new conn: IO::Socket::INET=GLOB(0x87ae5a0) (213.221.93.221:47998) for reverse_proxy
ClientProxy::event_read
  no headers.  reading.
Perlbal::Socket::read_headers(Perlbal::ClientProxy=ARRAY(0x87ad700)) is_res=0
  client disconnected






Mogstored (backend) debug output:

______________________________________


write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [GET /dev1/usage HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <245>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 130
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
Got new conn: IO::Socket::INET=GLOB(0x83b52e8) (213.221.93.198:54833) for web_server
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x84cd01c)) is_res=0
  pre-parsed headers: [GET /dev1/0/000/000/0000000018.fid HTTP/1.0
Connection: keep-alive
Host: image.bizimalem.com]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x84cd01c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x84cd01c), <246>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 1326
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      39
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [GET /dev1/usage HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <245>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 130
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [PUT /dev1/test-write/test-write-5627 HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805
Content-Length: 25]
  pushing back 25 bytes after header
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <138>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 734)
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <18>"<h1>200 - OK</h1>
") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 735)
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <15>"CODE(0x889103c)") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 741)
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [GET /dev1/test-write/test-write-5627 HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <244>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 25
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      67
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [GET /dev1/usage HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <245>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 130
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      80
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x84cd01c)) is_res=0
  client disconnected
Perlbal::Socket::read_headers(Perlbal::ClientHTTP=ARRAY(0x885ae0c)) is_res=0
  pre-parsed headers: [GET /dev1/usage HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Host: 213.221.93.230:7500
User-Agent: libwww-perl/5.805]
  got valid headers
ClientHTTPBase::setup_keepalive(Perlbal::ClientHTTP=ARRAY(0x885ae0c))
  service's persist_client = 1
  doing keep-alive to client
write(Perlbal::ClientHTTP=ARRAY(0x885ae0c), <245>"HTTP/1.0 200 OK
...") from (Perlbal::ClientHTTPBase, /usr/lib/perl5/site_perl/5.8.7/Perlbal/ClientHTTPBase.pm, 489)
REPROXY Sent: 130
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <5>"1      00
") from (main, /usr/bin/mogstored, 304)
write(Mogstored::SideChannelClient=ARRAY(0x8890eec), <2>".
") from (main, /usr/bin/mogstored, 304)


________________________________________


> Hi,
>
> I use perlbal (latest version) in front of my resin webserver as reproxy server to serve the images out of mogilefs and mogilefs java client from guba.
>
> To serve an an image, which is stored in mogilefs the following way applies:
>
> Client --> Perbal --reproxy---> resin (getfile.jsp).
>
> eg: http://www.domain.com/getfile.jsp?key=amazon
>
> domain.com is perlbal instance, getfile.jsp resides on backend resin instance. In getfile.jsp I use the java mogilefs client to get the image location.
>
> I use the following code in getfile.jsp to get the image with the key amazon
>
>
>
> <%
> String[] tracker = new String[1];
> tracker[0] = "213.221.93.230:6001";
> com.guba.mogilefs.MogileFS fs = new com.guba.mogilefs.MogileFS("testdomain", tracker, true);
> String[] paths = fs.getPaths(request.getParameter("k"), true);
> response.setHeader("Cache-Control", "must-revalidate");
> response.setHeader("Content-type",  "image/jpeg");
> response.setHeader("X-REPROXY-URL", (String)paths[0]);
> return;
> %>
>
> The image location is returned in paths. With X_REPROXY_URL the image location is passed back to perlbal but with the code above the image is never displayed in the client browser. What is wrong here?
>
> My perlbal config:
>
> image1:/home/bizimalem # cat /etc/perlbal.conf
> CREATE POOL webcluster
>   POOL webcluster ADD 213.221.93.230:8080
>
> CREATE SERVICE balancer
>    SET listen          = 213.221.93.198:80
>    SET role            = reverse_proxy
>    SET enable_reproxy  = true
>    SET pool            = webcluster
>    SET persist_client  = on
>    SET persist_backend = on
>    SET verify_backend  = off
> ENABLE balancer
>
> CREATE SERVICE mgmt
>   SET role   = management
>   SET listen = 213.221.93.198:60000
> ENABLE mgmt
>
>
>
> Thank you for your help.
>
>
> --
> Mit freundlichen Grüßen
>
> ___________________________
>
> Özcan Acar, Dipl. Inf(FH)
> Vorstand
> Smart Web Business AG
>
> Im Niederfeld 8
> 65462 Gustavsburg
>
> +49 171 57 33 66 5
> acar at unitedinter.net
>
>
> --
> Mit freundlichen Grüßen
>
> ___________________________
>
> Özcan Acar, Dipl. Inf(FH)
> Vorstand
> Smart Web Business AG
>
> Im Niederfeld 8
> 65462 Gustavsburg
>
> +49 171 57 33 66 5
> acar at unitedinter.net
>
>


-- 
Mit freundlichen Grüßen

___________________________

Özcan Acar, Dipl. Inf(FH)
Vorstand
Smart Web Business AG

Im Niederfeld 8
65462 Gustavsburg

+49 171 57 33 66 5
acar at unitedinter.net



More information about the mogilefs mailing list