For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > May 2007 > Transmission breakdown on a two-tier server setup









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Transmission breakdown on a two-tier server setup
Mark Brown

2007-05-15, 7:56 am

I'm experiencing a transmission failure issue trying to communicate
between servers in a two-tier architecture.

To explain; I have a photographic site on a rental shared web server.
I keep low-resolution "web" images and thumbnails on the rental
server, but for reasons of disk space and server performance I want to
keep the original full-size high-resolution images on my home server.
My home server is behind my ISP's NAT firewall, so I use dynamic DNS
to get its IP address from the rental server.

When I want to regenerate a low-resolution web image on the rental
server (e.g. to change the size or imprinted watermark information), I
send a command to a perl CGI script on the rental server (by way of a
web form). The script on the rental server then fires a GET request to
my home server using LWP::UserAgent, specifying the image id, size and
other parameters. A script on my home server processes the high-
resolution original image as specified and returns the resulting image
as the response. Finally, the rental server refreshes the page
displayed to the web client.

The problem is as follows. If the source (full-resolution) image is
fairly small (up to 1k pixels down the long side, say), my home server
responds fairly quickly to the GET request from the rental server and
all is well. However, if the source image is large (up to 5200 pixels
down the long side) then my home server takes rather longer to come
back - say 60 seconds from receiving the request. It attempts to send
the image back to the rental server (setting the Content-Length field
to the length of the image in bytes), but the transmission fails. From
the rental server end, eventually LWP::UserAgent request returns '500
read timeout', even though my home server is trying to send it data.

Using a packet sniffer, I can see my home server trying to send data
the response to the GET, but I then see any number of re-transmissions
of the first TCP packet segment. At that point, the GET request from
the rental server has not yet timed out. The transmission has broken
down for some reason. My home server is trying to send, the rental
server is trying to receive, but they can't talk.

Any ideas as to what's causing the transmission breakdown, and how I
can work around it?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com