Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Jul 15, 2019 3:30 pm
xojo

All times are UTC - 5 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: ServerSocket.MaximumSocketsConnect Question
PostPosted: Thu Jun 07, 2012 4:32 pm 
Offline
User avatar

Joined: Wed Oct 05, 2005 1:21 pm
Posts: 515
Location: United Kingdom
What's the practical limit for ServerSocket.MaximumSocketsConnected?

I only ask because I'm currently writing an online game that has a Web Edition app acting as the server and multiple desktop clients connecting to it via the WE app's ServerSocket subclass.

Each desktop client needs to remain connected to the server for the duration of their gaming session. Obviously I'd love it if my game became a huge hit and 100,000 people were online at one time but I know that this is a pipe dream.

Nevertheless, I'd like to know what the practical limit for the number of simultaneous connections to a ServerSocket is. I'm sure it depends on the server the WE app is running on (mine's an InMotion Hosting virtual private server). If you tell me it 50-100 I'm seriously going to have to rethink how to approach handling connections whereas if you tell me it's 10,000 then I'm much happier :)

Thanks in advance,

MadDoc

_________________
Gorgeous REALbasic controls from Figa Software | My Flickr | My Blog
11" MacBook Air 1.8Ghz i7, 4GB RAM, OSX 10.8.2, RB 2012 r1.1 Pro | iPhone 4S 32GB | Nikon D60


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Thu Jun 07, 2012 4:40 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
You're bound to hit the OS limit first, I would guess. For example, Windows has a limit of 65535 open sockets.


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Thu Jun 07, 2012 5:07 pm 
Offline
User avatar

Joined: Wed Oct 05, 2005 1:21 pm
Posts: 515
Location: United Kingdom
I could live with 65,000 users :)

Even if my VPS could cope with more than that (probably not) how would one go about expanding capacity? Two, three or four web apps on different servers??

_________________
Gorgeous REALbasic controls from Figa Software | My Flickr | My Blog
11" MacBook Air 1.8Ghz i7, 4GB RAM, OSX 10.8.2, RB 2012 r1.1 Pro | iPhone 4S 32GB | Nikon D60


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 12:40 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:roll: I doubt if your VPS would even cope with a couple of hundred sounds like you are going to need to some serious Dynamic Load Balancing...


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 12:47 pm 
Offline
User avatar

Joined: Wed Oct 05, 2005 1:21 pm
Posts: 515
Location: United Kingdom
n00bi3 wrote:
:roll: I doubt if your VPS would even cope with a couple of hundred sounds like you are going to need to some serious Dynamic Load Balancing...


Dynamic load balancing? (please excuse my ignorance)

_________________
Gorgeous REALbasic controls from Figa Software | My Flickr | My Blog
11" MacBook Air 1.8Ghz i7, 4GB RAM, OSX 10.8.2, RB 2012 r1.1 Pro | iPhone 4S 32GB | Nikon D60


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 1:17 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
To handle that amount of traffic you are going to need some serious Tier1 grade bandwidth and distributed load balancing solution to handle connections - which is not going to be cheap....!

This may help to explain further

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.175.7176

http://en.wikipedia.org/wiki/BigWorld

:wink:


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 2:29 pm 
Offline

Joined: Tue Mar 23, 2010 8:44 pm
Posts: 673
I would not use WE to handle many concurrent connections since it is very slow.

You should write your own game server in the form of a console app using RS or a different language like C.

How many connects your VPS can handle depends on a lot of things such as how much CPU, ram, etc. Each connection uses up some ram so the more ram = more connects if you havent hit another imit (OS,VPS, etc.) You can run your own tests locally to get an idea of consumption. Ask your VPS support if tey allow thousands of concurrent connects.

If you're not doing constant streaming data and you don't have thousands of users online at the same time your small VPS could probably do ok. Especially if your data doesn't have to be real time such as a turn based game.

For scaling make a traffic directing app that points to other servers (load appropriate) or see if some company handles load balancing for you.

HTH.


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 2:49 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:mrgreen: I agree you really should speak to your VPS provider first. I had 60 clients connect to my VPS hosted web application last year within a 5 minute period which triggered my hosting providers IDS (Intrusion Detection System) as a Denial of Service Attack :lol:

Also i am not knocking real basic as i have grown very fond of it over the last few weeks however i have doubts if the RB web application would be up for the job...!


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 3:55 pm 
Offline
User avatar

Joined: Wed Oct 05, 2005 1:21 pm
Posts: 515
Location: United Kingdom
J.Sh3ppard wrote:
I would not use WE to handle many concurrent connections since it is very slow

n00bi3 wrote:
Also i am not knocking real basic as i have grown very fond of it over the last few weeks however i have doubts if the RB web application would be up for the job...!


I'm intrigued as to why a console app running on my VPS would be substantially faster than a WE app. Aren't WE apps essentially console apps which serve HTML to a browser? Most of the "legwork" of the game server will be methods attached to TCPSocket classes. I just thought a WE app would be useful as I could have an "admin" page I could visit in a browser to check the status of online clients, etc.

J.Sh3ppard wrote:
If you're not doing constant streaming data and you don't have thousands of users online at the same time your small VPS could probably do ok. Especially if your data doesn't have to be real time such as a turn based game.


That's good to know. The game is not real time. The game server just handles database requests and other simple, non-streaming, tasks.

_________________
Gorgeous REALbasic controls from Figa Software | My Flickr | My Blog
11" MacBook Air 1.8Ghz i7, 4GB RAM, OSX 10.8.2, RB 2012 r1.1 Pro | iPhone 4S 32GB | Nikon D60


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 4:15 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
MadDoc wrote:
I'm intrigued as to why a console app running on my VPS would be substantially faster than a WE app. Aren't WE apps essentially console apps which serve HTML to a browser? Most of the "legwork" of the game server will be methods attached to TCPSocket classes. I just thought a WE app would be useful as I could have an "admin" page I could visit in a browser to check the status of online clients, etc.


Though I have not tested this, I imagine a socket running in a WE app would be as fast as a socket running in a console app.

I don't think WE is slow for what it's doing. But it gets that reputation because of a few factors people fail to consider and/or mitigate in their code.

Quote:
That's good to know. The game is not real time. The game server just handles database requests and other simple, non-streaming, tasks.


Without actually testing your code base it's impossible to know what the performance and scaling will be. That said, if you are expecting a lot of users initially a used 1U server off eBay ($200-$300) placed in a cohost location ($50-$100 per month) will give you far better performance then your average VPS.

If you're not constantly streaming data in real time, you might want to revisit the decision to have clients constantly connected. You're balancing the time to open/close a socket vs. tying up resources for the entire game.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 4:39 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:lol: @ taylor-design A 1U Pentium 133MHz 16MB of EDO Ram rackmount server from Ebay cohosted in a Datacentre out performing a VPS.


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 4:57 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:o That's the problem nowadays most software developers that program applications do just that. Little have no clue when it comes to scalability, performance, hosting requirements, bandwidth, fail over , redundancy, load balancing, security, authentication etc...


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 5:30 pm 
Offline

Joined: Tue Mar 23, 2010 8:44 pm
Posts: 673
MadDoc wrote:
I'm intrigued as to why a console app running on my VPS would be substantially faster than a WE app. Aren't WE apps essentially console apps which serve HTML to a browser? Most of the "legwork" of the game server will be methods attached to TCPSocket classes. I just thought a WE app would be useful as I could have an "admin" page I could visit in a browser to check the status of online clients, etc.

That's good to know. The game is not real time. The game server just handles database requests and other simple, non-streaming, tasks.


Hi. WE apps with a browser for access would be much slower than a console app with a desktop client.
Why?
I would say more than one reason here could be the WE app bridge script, the cgi process with the server, the additional browser load and render times, the Javascript , etc. Point is WE apps are sloow compared to other solutions like a console app or php and esp. C.

Since you don't need persistent connections use httpsocket in your desktop app to communicate with your console app or php script on the server.
If you use php you'll want to use cookies to maintain state to give the illusion of a consistency/persistance of state.
A benefit to using php is you could probably host your game on a lower cost shared server. At least until you got lots of users if that happens. We're talking about $5 to $6 a month.

Not having a persistant connection requires you to either have the server contact your app when new data becomes available -HTML 5 can do this and should be able to work with a RS desktop client unless there is something not up to spec with RS.

Or, the less professional way is to have your app periodically poll the server checking if there is any new data for that client.

It is easier to have a constant connection using TCP sockets but it uses more resources.
Btw you should ask your VPS provider if you have any ports available to receive incoming connections. Your console app won't use webpage for communications it will accept the connection personally on a port you set to listen.

For $30 a month you can colocate your own mac mini. Not much more than many VPS plans and you wouldn't have to share resources. Just keep in mind if you use an ld computer the likelyness of a drive failure is increased unless you replace it.


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 5:58 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
n00bi3 wrote:
:lol: @ taylor-design A 1U Pentium 133MHz 16MB of EDO Ram rackmount server from Ebay cohosted in a Datacentre out performing a VPS.


I've designed and deployed solutions that utilize multiple application and database servers, fully load balanced with fail over, in order to meet critical performance and availability requirements for my clients. I know this area well.

$300 on eBay will buy something like this: http://www.ebay.com/itm/Supermicro-X7SB ... 2c65d797c8

I guarantee you that will out perform a VPS account scaled to the same monthly cost as a cohost because I just recently moved a client from a VPS to a used 1U server. $300 for the server plus $75 per month gives them greater performance and resources (CPU; RAM; bandwidth) then they were getting from a $200 per month VPS account.

That's not to say there aren't VPS and cloud hosting options capable of scaling beyond a single server. There are. But dedicated servers are still competitive from a price/performance stand point, especially when the hardware is purchased on the used market.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
 
 Post subject: Re: ServerSocket.MaximumSocketsConnect Question
PostPosted: Fri Jun 08, 2012 6:29 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
J.Sh3ppard wrote:
Hi. WE apps with a browser for access would be much slower than a console app with a desktop client.


If I understand MadDoc correctly, he intends to develop a WE app that has WE pages for admin, but uses ServerSockets to handle desktop client connections. The ServerSockets should be just as fast as in a console app.

Quote:
Point is WE apps are sloow compared to other solutions like a console app or php and esp. C.


Properly coded WE apps are faster then PHP. C may be faster if the server task is CPU intensive, but at a higher development cost. If the server's tasks are bound by bandwidth and/or database responses, then C offers no advantage.

Quote:
Not having a persistant connection requires you to either have the server contact your app when new data becomes available -HTML 5 can do this and should be able to work with a RS desktop client unless there is something not up to spec with RS.

Or, the less professional way is to have your app periodically poll the server checking if there is any new data for that client.


At the level MadDoc is working at, it's all the same. Server-Sent events depend on the client contacting the server first. WebSockets are an always open connection. He has the same choices before him whether he uses an HTTPSocket or a TCP socket.

Any solution that involves the server actually initiating contact with the client will require the gamer to setup port forwarding on his firewall or broadband modem.

Without knowing the communications requirements for the game I can't recommend one solution over the other. If the polling time is long enough, then that pattern will conserve resources. If not, then he might as well keep open connections. If gamers are willing to setup port forwarding, then he can have the best of both worlds.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group