an intriguing wifi http server mystery...please help

J

jojoba

Hi,
I hope this post is ok for this group.

Here's my deal:

I have two computers on my LAN at home.
One desktop. One laptop.
Both computers are wireless enabled (and wired enabled too).

I have running a fairly simple HTTP server (written in python) that i
can run on either computer.
When the computers are wired, everything is cool, no matter which
computer is the server.
But when the computers are wireless, it does matter which computer is
the server.
If the laptop is the server, the server is super slow at serving pages.
If the desktop is the server, then everything's fine (i.e. fast).

Here are the conditions i tested the server under.

1)
Laptop wired, client
Desktop wired, server
GREAT!
webpage served in 2 seconds

2)
Laptop wired, server
Deskop wired, client
GREAT!
webpage served in 2 seconds

3)
Laptop wireless, client
Desktop wireless, server
GREAT!
webpage served in 2 seconds

4)
Laptop wireless, server
Desktop wireless, client
CRAP!
webpage served in 90 seconds


What the heck is happening?
What could be causing the slowdown in only one direction?
Specifically, why is the server so slow when the laptop is wireless,
but not when the desktop is wireless?
And computer speed cannot matter here, right, since, in the wired
conditions, both computers performed equally.


The server is almost entirely based on the server found at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259148



If anyone has a clue, please tell.
Thanks,
jojoba
 
P

Paul McNett

1)
Laptop wired, client
Desktop wired, server
GREAT!
webpage served in 2 seconds

2)
Laptop wired, server
Deskop wired, client
GREAT!
webpage served in 2 seconds

3)
Laptop wireless, client
Desktop wireless, server
GREAT!
webpage served in 2 seconds

4)
Laptop wireless, server
Desktop wireless, client
CRAP!
webpage served in 90 seconds


What the heck is happening?

Please post your routing tables and, if you are referencing your server machine
by name, your name server addresses (/etc/resolv.conf on Linux).
 
T

Timothy Smith

Paul said:
(e-mail address removed) wrote:



Please post your routing tables and, if you are referencing your server machine
by name, your name server addresses (/etc/resolv.conf on Linux).
i'm inclined to agree, your client and server might be taking totally
different routes to get to each other and hence the 90ms
 
J

jojoba

Hi again,

Please excuse any ignorance here.
I would love to show you what you are asking for, but I am not sure
what you are asking for (newbie here).

All these connections (i.e. client-server connections) are within my
local area network.

I have a simple linksys 802.11b router.
My server is set to say, "192.168.1.100", port 9999,
and my client is set to say, "192.168.1.101"

I load up the server, then go to the client computer webbrowser and
enter "http://192.168.1.100:9999"

You guys probably already know this, so let me know if i need to be
more specific.
Thanks again for the rapid response!
jojoba
 
P

Paul McNett

Please excuse any ignorance here.
I would love to show you what you are asking for, but I am not sure
what you are asking for (newbie here).

All these connections (i.e. client-server connections) are within my
local area network.

I have a simple linksys 802.11b router.
My server is set to say, "192.168.1.100", port 9999,
and my client is set to say, "192.168.1.101"

I load up the server, then go to the client computer webbrowser and
enter "http://192.168.1.100:9999"

If you are on Windows, please open a command window (Start|Run and then type
'cmd') and type:

route print

On Linux or Mac, the command would simply be:

route


Do this on both computers, and post the output here. If you are using ip
addresses only in your URL's the problem isn't with DNS or name lookup so let's
eliminate a routing problem next.
 
J

jojoba

Hello again!


Heres the CLIENT info you requested:

===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x20002 ...00 09 5b 41 0c b7 ...... NETGEAR MA311 PCI Adapter - Packet
Scheduler
Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface
Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.107
30
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1
1
192.168.0.0 255.255.255.0 192.168.0.107 192.168.0.107
30
192.168.0.107 255.255.255.255 127.0.0.1 127.0.0.1
30
192.168.0.255 255.255.255.255 192.168.0.107 192.168.0.107
30
224.0.0.0 240.0.0.0 192.168.0.107 192.168.0.107
30
255.255.255.255 255.255.255.255 192.168.0.107 192.168.0.107
1
Default Gateway: 192.168.0.1
===========================================================================
Persistent Routes:
None



Here's the SERVER info you requested:

===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x40003 ...00 d0 59 49 2e 2c ...... LAN-Express IEEE 802.11 PCI Adapter
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface
Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.105
30
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1
1
192.168.0.0 255.255.255.0 192.168.0.105 192.168.0.105
30
192.168.0.105 255.255.255.255 127.0.0.1 127.0.0.1
30
192.168.0.255 255.255.255.255 192.168.0.105 192.168.0.105
30
224.0.0.0 240.0.0.0 192.168.0.105 192.168.0.105
30
255.255.255.255 255.255.255.255 192.168.0.105 192.168.0.105
1
Default Gateway: 192.168.0.1
===========================================================================
Persistent Routes:
None

(hope the text-formatting doesn't make it too unreadable!)
Note: this is for the condition that is SLOW.
Hope this helps
Thanks again,
jojoba
 
I

Istvan Albert

The server is almost entirely based on the server found at:

Try using a different python based webserver. This recipe might have
some problems that cause the weird behavior.

(The Karigell webframework uses a server based on this recipe. In their
changlog for the latest release they say: "It fixes 2 bugs, one in the
asynchronous HTTP server which would use 100% of the CPU")

Istvan.
 
J

jojoba

Thanks Istvan,

But if it's a problem with the software, why does the server work
great when wired (i.e. not wireless)...that's the weird part.

Thanks again,
jojoba
 
I

Istvan Albert

But if it's a problem with the software, why does the server work
great when wired (i.e. not wireless)...that's the weird part.

Don't be so quick to eliminate software error ... when it comes to
bugs there are few rules. You are using a recipe that is *known* to
produce weird behavior. Make sure to eliminate that source before
moving to more esoteric reasons such as bad routing table. For example
run some other simple webservers that were written in some other
language and see if you get the same behavior (tinyhttpd or its ilk) .

Istvan.
 
J

jojoba

Hi again Istvan,

Good suggestion.
I have tried another server and it works flawlessly, regardless of the
computers being wireless or wired. Excellent.
However, i am still intrigued as to why the server is fast when both
computers are wireless and the desktop is the server (while the laptop
is the client), but slow when both computers are wireless and the
desktop is the client (while the laptop is the server).
I guess i am just curious as to what possible thing (most likely in
software, as we have discovered) could cause this assymetry.

Thanks for any ideas,
jojoba
 
I

Irmen de Jong

Hi again Istvan,

Good suggestion.
I have tried another server and it works flawlessly, regardless of the
computers being wireless or wired. Excellent.
However, i am still intrigued as to why the server is fast when both
computers are wireless and the desktop is the server (while the laptop
is the client), but slow when both computers are wireless and the
desktop is the client (while the laptop is the server).
I guess i am just curious as to what possible thing (most likely in
software, as we have discovered) could cause this assymetry.

Thanks for any ideas,
jojoba


Just a guess: could it be that your server is doing reverse-dns lookups?
(i.e. it does socket.gethostbyaddr to get names by ip addresses,
perhaps for logging or whatnot)
This call is expensive. Sometimes this call takes ages to complete,
if you have a broken DNS config.


--Irmen
 
J

jojoba

Just a guess: could it be that your server is doing reverse-dns lookups?
(i.e. it does socket.gethostbyaddr to get names by ip addresses,
perhaps for logging or whatnot)
This call is expensive. Sometimes this call takes ages to complete,
if you have a broken DNS config.


Interesting...
But how do we explain that the server is fast on one computer and slow
on another (when both are wireless)? This is my main mystery.
But perhaps i don't completely understand your point.
Could the above server-speed assymetry that i spoke of above be caused
by this reverse dns lookup?

Thanks for all the suggestions,
jojoba
 
P

Paul Boddie

Could the above server-speed assymetry that i spoke of above be caused
by this reverse dns lookup?

I think so. You stated that you use "a fairly simple HTTP server",
although that's not exactly specific enough to diagnose the problem,
but if that were the standard library's BaseHTTPServer then reverse DNS
lookups could well be an issue: that particular server attempts to log
addresses, and in the address_string method there's a call to
socket.getfqdn which could invoke such reverse lookups.

Paul
 
J

jojoba

Hello again everyone,

First, I want to thank all those who have contributed to the
unravelling of this server-slow-down mystery.
But unfortunately, either:

1) i have not made my point clear about what my question is
2) i do not understand the responses given

So, let me briefly reiterate what the mystery is.
(i am assuming that readers have read most of my first post above).
I have two computers and a server program (written in python).
Both computers are on my home lan (using a linksys wifi router).
HERE IS THE MYSTERY:
The server runs fast when one computer is the server, but slow when the
other computer is the server.
How can this be, given that this asymmetry does not exist when both
computers are wired.

Please let me know if you need any more information,
Thanks again to all who have been helping with this,
jojoba
 
P

Paul Boddie

The server runs fast when one computer is the server, but slow when the
other computer is the server.
How can this be, given that this asymmetry does not exist when both
computers are wired.

Probably because the way your wireless interfaces are configured may be
different from the way your wired interfaces are configured. Network
problems are hard enough to solve "on site" with full access to all the
necessary information - doing so with substantially less information in
a newsgroup thread is substantially more difficult.

With regard to my point about the "fairly simple HTTP server" that you
are using, if you choose to run whichever server such that you can see
it writing its log - for BaseHTTPServer this is easy since it just
writes its log to the terminal/console - then you might be able to see
where the delay occurs by putting logging statements in your program at
the start and end of its work. If your program seems to write its
finishing logging message and yet a long delay occurs before the server
writes something about where the request came from (and the browser
gets to see the output of your program), then you may well have a
problem with the way the server prepares its logging messages as I
described in my last message.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top