Atomic Web Server

Just starting out? Need help? Post your questions and find answers here.
User avatar
J. Baker
Addict
Addict
Posts: 2192
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Atomic Web Server

Post 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
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post 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
~Dreglor
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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!!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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
Tranquil
AngelSoul
User
User
Posts: 55
Joined: Tue Jul 29, 2003 9:16 am
Location: Canada

Post 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.
AMD 1.8 - 512mb - ATI All-In-Wonder Radeon 9000 pro - W2k Pro
BASIC programmers never die, they just return without gosub.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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....
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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
Tranquil
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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...
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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
Tranquil
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: Atomic Web Server

Post 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 :((
pthien
Enthusiast
Enthusiast
Posts: 150
Joined: Sun Jun 29, 2003 9:39 pm

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

Post 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
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

It's not threaded at all. It's just processing single requests so fast that it seems instant.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
pthien
Enthusiast
Enthusiast
Posts: 150
Joined: Sun Jun 29, 2003 9:39 pm

Maybe yes, maybe no

Post 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
Post Reply