Page 1 of 1

Atomic Web Server

Posted: Tue Sep 09, 2003 6:15 am
by J. Baker
Ok, been away awhile from programming, although I don't know much about programming anyway. My question is about Atomic Web Server. Wanting to learn about web servers.

How was it calculated that this server could serve 255 conections?

Would this code have to be redone to add more connections or is this the limit with PB?

Any info would be great. :D

Posted: Tue Sep 09, 2003 7:33 am
by Dreglor
i haven't look at this very well but i think it because of hardware resrictions on it
but also he could of put in a built in limit
or it could be that he ahs some sort of id (othere than ip's) that is a byte number that he used to give to the connections

if thats the case you could reporgramm it ot hold more that that but 155 is quite over my connection
(cable 600k up max)
you need a fiberoptic conncetion to do something like that

Posted: Tue Sep 09, 2003 8:27 am
by Karbon
Though I don't know for sure where the 255 simultaneous connection limit is imposed I'd say it's internally in PureBasic or a Windows sockets limitation.. It's certainly not a hardware problem or limitation.. Connections don't equal bandwidth so the speed of your Internet connection wouldn't have much to do with the ability to support simultaneous connections..

255 *simultaneous* connections is quite a lot for a web server... That's more than most big web servers support by default AFAIK..

Anyway, someone else can chime in and tell you for sure why it's limited to 255.

Good luck!!

Posted: Tue Sep 09, 2003 2:21 pm
by Tranquil
Windows allocates a word for sockets. So normal up to 65535 connections per server should be possible. Dont know how other applications can do more. (Edonkey Server eg. allows more then 100.000 connections or even more to one socket.) Dont know how they do it.

Mike

Posted: Tue Sep 09, 2003 3:08 pm
by AngelSoul
That's when you see the famous message:
Server busy, try again later :)

Anyway, a (popular) web server can easily exceed 255 connections, afterall images are also counted as a connection.

Posted: Tue Sep 09, 2003 7:09 pm
by Num3
255 connections per sockect is a TCP/IP limit...

To use more than that service providers create clusters of machines that dispacth requests to the port of another cluster.

Image two instances of the same server running on the same machine, when a socket on one get's close to it's limit it the passes requests to the other app, which replies for him....

Imagine google.... how many users do a search at the same time world wide? If the main server could not dispatch the requests to other cluster you would never do a search!

Also this problem in main servers is solved through hardware i believe....

The way file sharing works is diferent, you connect to a port, and the connections for downloads or uploads are made through other ports that are agreed between both machines (see FTP protocol to understand), so in this case you can have up to 65000 ports....

Posted: Tue Sep 09, 2003 7:24 pm
by Tranquil
Num3 wrote:255 connections per sockect is a TCP/IP limit...

The way file sharing works is diferent, you connect to a port, and the connections for downloads or uploads are made through other ports that are agreed between both machines (see FTP protocol to understand), so in this case you can have up to 65000 ports....
This is not realy true. Take a look on Edonkey-Servers under windows. Its a single instance and more then 7000 users were connected to my system as I tried it.

Cheers
Mike

Posted: Tue Sep 09, 2003 7:39 pm
by Num3
But not in real time.... if you use a smart queue you can have infinite connections to the same socket.....

A list of users is not the same thing has a user being there using that sockect....

You can just connect, register or do what you want and free the sockect, but sitll be registered on the server...

Posted: Tue Sep 09, 2003 8:22 pm
by Karbon
Anyway, a (popular) web server can easily exceed 255 connections, afterall images are also counted as a connection.
True, but there is a big difference in 255 connections and 255 simultaneous connections. That's 255 different connections at *exactly* the same time. I was just making the point that 255 isn't a low number for a web server (since HTTP is stateless)...

Anyway.. On with the show!

Posted: Tue Sep 09, 2003 9:41 pm
by Tranquil
Okay, I made a test. Created a server and a client which permanently connects to it. (Just a console app)

I'm now connected more then 5000 times to the same socket. Which means:

One server on port 4949 and (atm exactly 6320 connections) to this server.

Possible I dont get the point. All these connections are active. If I close the client all sockets get freed.

So its definitly possible to connect more then 255 users to one socket.

Maybe I got something wrong. :-)

Cheers
Mike

Posted: Tue Sep 09, 2003 10:59 pm
by Karbon
Since the Atomic Web Server was written severla years ago maybe that's a reference to a limitation in PureBasic that has since been removed?

Re: Atomic Web Server

Posted: Wed Sep 10, 2003 12:07 am
by Doobrey
J. Baker wrote: How was it calculated that this server could serve 255 conections?

Would this code have to be redone to add more connections or is this the limit with PB?
I just looked at the code (dated 25/3/2001) and the whole thing is single threaded..it can only handle 1 connection at a time, so where did the 255 connections come from( maybe CreateNetworkServer() only handles 255 connections with older versions of Windows)?

If you want more concurrent connections, then you gotta spin off each request to a separate thread, but then you get into problems because of PB`s strings being unsafe to use in threads :((

Yeah, I don't get it, but it works

Posted: Wed Sep 10, 2003 2:00 pm
by pthien
I use the Atomic Web Server at work (http://cgallery.dyndns.org) and looking at the code it doesn't look threaded. So I wondered how it could handle more than a single connection. I think it is because the library functions it uses to transmit files are themselves threaded or threads? That is, I can have two client machines at work simultaneously download large files from the Atomic Web Server and AWS will still serve up pages to any and all other clients coming in. So I assume the small part of the code that parses requests can only handle a single client at a time, but that code runs so fast and hands things off to the threaded library functions so quickly that it doesn't matter?

I could be all wrong, too. :-)

Thanks,
Phil

Posted: Wed Sep 10, 2003 3:37 pm
by Karbon
It's not threaded at all. It's just processing single requests so fast that it seems instant.

Maybe yes, maybe no

Posted: Wed Sep 10, 2003 4:06 pm
by pthien
If I have it xfer a 200-MB file, which doesn't happen instantly, it can xfer it to more than a single client at a time. I've tried it with at least two different clients.

If you go to http://cgallery.dyndns.org and download the zipped manual to your machine several times simultaneously (just keep clicking on it), you'll see two things: (1) The Atomic Web Server can do more than one thing at a time and (2) I need more bandwidth. :-)

Thanks,
Phil