Networking Forums

Networking Forums > Computer Networking > Linux Networking > Proxy that connects 2 different networks

Reply
Thread Tools Display Modes

Proxy that connects 2 different networks

 
 
zferentz@gmail.com
Guest
Posts: n/a

 
      09-17-2007, 10:21 AM
Hi,

I've encountered a problem that i can't easily resolve, so i'd
appreciate any help.
I'm writing a HTTP proxy - the client (wget/browser) connects to a
listening-socket, and the proxy passes the HTTP request to a
webserver, then passing the reply from the webserver to the client.

My proxy do NOT accumulate the data returned from the WebServer : i'm
using epoll() , and each time my read() request is filled with data, i
send the data to the other side and free the buffer .

Everything works great when both the client and the webserver running
in the same network or using the same speed (100MB , 1GB) . however
when the client is living in a low-speed network (10MB) and the
webserver lives in a high-speed network (1GB) , i get performance
problems due to swapping .

My questions are practical and theoretical as well :
1. since i'm dealing with two different sockets (client socket+server
socket) , how can i tell the server-socket to use the speed of the
client-socket ? is it the Window-Size ?
2. since my process do not accumulate the memory , why do i see the
memory gets bigger ? (top command), i would expect the kernel/machine
to keep the memory, but not the process...
3. finally, how proxy usually deals with this problem ? i guess that
i'm not the first one trying to connect two different networks with
two statefull connections ...

thank you very much
zferentz

 
Reply With Quote
 
 
 
 
Robert Harris
Guest
Posts: n/a

 
      09-17-2007, 11:39 AM
(E-Mail Removed) wrote:
> Hi,
>
> I've encountered a problem that i can't easily resolve, so i'd
> appreciate any help.
> I'm writing a HTTP proxy - the client (wget/browser) connects to a
> listening-socket, and the proxy passes the HTTP request to a
> webserver, then passing the reply from the webserver to the client.
>
> My proxy do NOT accumulate the data returned from the WebServer : i'm
> using epoll() , and each time my read() request is filled with data, i
> send the data to the other side and free the buffer .


What do you do if the send() blocks or otherwise doesn't succeed?

Robert

>
> Everything works great when both the client and the webserver running
> in the same network or using the same speed (100MB , 1GB) . however
> when the client is living in a low-speed network (10MB) and the
> webserver lives in a high-speed network (1GB) , i get performance
> problems due to swapping .
>
> My questions are practical and theoretical as well :
> 1. since i'm dealing with two different sockets (client socket+server
> socket) , how can i tell the server-socket to use the speed of the
> client-socket ? is it the Window-Size ?
> 2. since my process do not accumulate the memory , why do i see the
> memory gets bigger ? (top command), i would expect the kernel/machine
> to keep the memory, but not the process...
> 3. finally, how proxy usually deals with this problem ? i guess that
> i'm not the first one trying to connect two different networks with
> two statefull connections ...
>
> thank you very much
> zferentz
>

 
Reply With Quote
 
zferentz@gmail.com
Guest
Posts: n/a

 
      09-18-2007, 10:07 AM
On Sep 17, 1:39 pm, Robert Harris <robert.f.har...@blueyonder.co.uk>
wrote:
> zfere...@gmail.com wrote:
> > Hi,

>
> > I've encountered a problem that i can't easily resolve, so i'd
> > appreciate any help.
> > I'm writing a HTTP proxy - the client (wget/browser) connects to a
> > listening-socket, and the proxy passes the HTTP request to a
> > webserver, then passing the reply from the webserver to the client.

>
> > My proxy do NOT accumulate the data returned from the WebServer : i'm
> > using epoll() , and each time my read() request is filled with data, i
> > send the data to the other side and free the buffer .

>
> What do you do if the send() blocks or otherwise doesn't succeed?
>
> Robert
>
>
>
>
>
> > Everything works great when both the client and the webserver running
> > in the same network or using the same speed (100MB , 1GB) . however
> > when the client is living in a low-speed network (10MB) and the
> > webserver lives in a high-speed network (1GB) , i get performance
> > problems due to swapping .

>
> > My questions are practical and theoretical as well :
> > 1. since i'm dealing with two different sockets (client socket+server
> > socket) , how can i tell the server-socket to use the speed of the
> > client-socket ? is it the Window-Size ?
> > 2. since my process do not accumulate the memory , why do i see the
> > memory gets bigger ? (top command), i would expect the kernel/machine
> > to keep the memory, but not the process...
> > 3. finally, how proxy usually deals with this problem ? i guess that
> > i'm not the first one trying to connect two different networks with
> > two statefull connections ...

>
> > thank you very much
> > zferentz- Hide quoted text -

>
> - Show quoted text -


Hi Robert,

if the send() fails i disconnect from both sides (close client+server
sockets),
However, if the send() partially succeeded (only part of the data was
sent) , i'm trying to resend the rest .

In Windows, if i'm trying to send too much data , beyond some kernel-
buffers , the send() will fail. however , i'm not sure whether this is
the case with Linux... maybe the kernel accumulate the memory and i
cannot do anything about it or cannot even tell that i'm sending too
much memory...

Any ideas ? how usually proxies deals with such problems ? Does it
have anything with the "TCP congestion" or TCP-window-size ?

tnx again,
zferentz

 
Reply With Quote
 
zferentz@gmail.com
Guest
Posts: n/a

 
      09-19-2007, 05:00 PM
On Sep 18, 12:07 pm, zfere...@gmail.com wrote:
> On Sep 17, 1:39 pm, Robert Harris <robert.f.har...@blueyonder.co.uk>
> wrote:
>
>
>
>
>
> > zfere...@gmail.com wrote:
> > > Hi,

>
> > > I've encountered a problem that i can't easily resolve, so i'd
> > > appreciate any help.
> > > I'm writing a HTTP proxy - the client (wget/browser) connects to a
> > > listening-socket, and the proxy passes the HTTP request to a
> > > webserver, then passing the reply from the webserver to the client.

>
> > > My proxy do NOT accumulate the data returned from the WebServer : i'm
> > > using epoll() , and each time my read() request is filled with data, i
> > > send the data to the other side and free the buffer .

>
> > What do you do if the send() blocks or otherwise doesn't succeed?

>
> > Robert

>
> > > Everything works great when both the client and the webserver running
> > > in the same network or using the same speed (100MB , 1GB) . however
> > > when the client is living in a low-speed network (10MB) and the
> > > webserver lives in a high-speed network (1GB) , i get performance
> > > problems due to swapping .

>
> > > My questions are practical and theoretical as well :
> > > 1. since i'm dealing with twodifferentsockets (client socket+server
> > > socket) , how can i tell the server-socket to use the speed of the
> > > client-socket ? is it the Window-Size ?
> > > 2. since my process do not accumulate the memory , why do i see the
> > > memory gets bigger ? (top command), i would expect the kernel/machine
> > > to keep the memory, but not the process...
> > > 3. finally, how proxy usually deals with this problem ? i guess that
> > > i'm not the first one trying to connect twodifferentnetworkswith
> > > two statefull connections ...

>
> > > thank you very much
> > >zferentz- Hide quoted text -

>
> > - Show quoted text -

>
> Hi Robert,
>
> if the send() fails i disconnect from both sides (close client+server
> sockets),
> However, if the send() partially succeeded (only part of the data was
> sent) , i'm trying to resend the rest .
>
> In Windows, if i'm trying to send too much data , beyond some kernel-
> buffers , the send() will fail. however , i'm not sure whether this is
> the case with Linux... maybe the kernel accumulate the memory and i
> cannot do anything about it or cannot even tell that i'm sending too
> much memory...
>
> Any ideas ? how usually proxies deals with such problems ? Does it
> have anything with the "TCP congestion" or TCP-window-size ?
>
> tnx again,zferentz- Hide quoted text -
>
> - Show quoted text -


Hi Robert and thank you for your help.
I've found that problem , it has absolutely nothing with the kernel or
I/O, . since i'm working in nonblocking mode, i'm using queues to pass
data between one side and the other , the problem was that the queues
got huge due to the different push/pop differences (due to the network
differences) .

I completely forgot that i'm sending the data when the socket "is
ready" , so all the window-size stuff is completely irrelevant.

thnx

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int Mike Linux Networking 0 02-16-2008 08:35 PM
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int Mike Broadband 0 01-12-2008 09:35 AM
WAG300N does not show in list of available networks but connects O JMB Wireless Networks 0 01-28-2007 11:58 PM
Two wireless networks: I access one then Windows connects to the o Keith Wireless Networks 2 12-29-2004 07:02 AM
NETGEAR WG311T Only Connects to Netgear Networks Jethro Wireless Internet 4 10-27-2004 07:29 AM



1 2 3 4 5 6 7 8 9 10 11