CPU Utilization of Smartfoxserver

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

CPU Utilization of Smartfoxserver

Postby Progamer » 22 Mar 2017, 15:38

Hi,
I am developing a multiplayer game using Smartfoxserver. And I am a bit confused about what should be my server configuration on which my smartfox server will run. Can anyone explain me the logic behind CPU utilization of Smartfox server. Because first it shows "0.36' percent of CPU utilization when no client is logged on. For first client it increases to "25" percent. For second client it increases to "50" percent, for third client it increases to "75" percent and for fourth it increases to "100" percent CPU utilization. Then it remains at 100 percent. So, I am confused that it is a problem or it behaves like that only. Please help. Thank in advance.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 22 Mar 2017, 15:49

Hi,
where are you gathering the CPU utilization from?

Also are you running your own Extension code?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 22 Mar 2017, 16:47

I am gathering information from Administration tools->Dashboard panel. Yes, I am running my own extension code.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 22 Mar 2017, 17:09

100% CPU utilization for 4 connected users suggests you're either running the server on a Commodore 64 :mrgreen: ... Or you're doing something very wrong in your server side code ...

I would highly recommend to remove the Extension, and see what happens without. The expected behavior is that CPU won't budge, even on a low spec machine. At least not for 4 users :) If they were 400 you could expect a bit of "movement".

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 23 Mar 2017, 04:59

Hi,
I cannot remove extension because everything works on the basis of extension only.
When a user makes a new lobby then I run physics(box2d engine) on server for that lobby. So is that happening because of physics.
Also is there any way of debugging extension code.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 23 Mar 2017, 08:10

Running an instance of Box2D for every user might prove extremely taxing on the CPU.
Games uses one instance of the engine and it can already be pretty resources intensive... imagine that multiplied by, say, 100 users :shock:

Also is there any way of debugging extension code.

Sure:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item6

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 23 Mar 2017, 09:54

By instances you mean separate physics world for each game room ?

It is not for every user, it is made for each game room created by a user. Also one user can create only one game room at a time, if the user wants to create another room he/she has to leave the current game room. And also when the game room is destroyed the physics world is also destroyed.
Last edited by Progamer on 23 Mar 2017, 09:58, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 23 Mar 2017, 09:57

Yes.
Lapo

--

gotoAndPlay()

...addicted to flash games
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 23 Mar 2017, 10:01

It is not for every user, it is made for each game room created by a user. Also one user can create only one game room at a time, if the user wants to create another room he/she has to leave the current game room. And also when the game room is destroyed the physics world is also destroyed.
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 23 Mar 2017, 10:10

So what approach do you suggest.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 23 Mar 2017, 10:32

I don't know, I have no idea what you're trying to accomplish...
Something like Box2D can be very CPU intensive, which in turn depends on your game design and requirements. Since physics in multiplayer is a very tricky subject you will need to carefully evaluate what is absolutely necessary and what isn't to optimize the load on the server.

In any case any moderately intensive physics will require powerful servers to keep up.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Progamer
Posts: 13
Joined: 22 Mar 2017, 15:09

Re: CPU Utilization of Smartfoxserver

Postby Progamer » 23 Mar 2017, 10:41

Thanks.
User avatar
meanvel
Posts: 129
Joined: 19 Jan 2017, 14:06

Re: CPU Utilization of Smartfoxserver

Postby meanvel » 30 Mar 2017, 01:50

Just a bit of advice. Running pathfinding or physics code serverside will result in a nightmare in server expenses. You will not be able to successfully keep a game online without hemorrhaging serious cash.

Even simple games like virtual farming games and etc which simply allow users to have thousands of custom items... I had to use C++ extensions for data serialization just to get the data costs down enough to stay profitable. (That was using amfPhp, not SmartFox.)

You have to balance the clientside vs serverside code. Critical things users will attempt to cheat at like the generation of rare item drops... Have to be serverside and transactional. But, whatever isn't critical... Clientside!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Utilization of Smartfoxserver

Postby Lapo » 30 Mar 2017, 09:21

meanvel wrote:Just a bit of advice. Running pathfinding or physics code serverside will result in a nightmare in server expenses. You will not be able to successfully keep a game online without hemorrhaging serious cash.

Not necessarily, pathfinding is not as heavy as physics stuff. Not even close.

Code: Select all

Even simple games like virtual farming games and etc which simply allow users to have thousands of custom items... I had to use C++ extensions for data serialization just to get the data costs down enough to stay profitable. (That was using amfPhp, not SmartFox.)

Well, I can understand that as PHP is pretty bad in terms of scalability and not really the top choice for server side multiplayer. (Not even the top 20, I would argue :D )
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
meanvel
Posts: 129
Joined: 19 Jan 2017, 14:06

Re: CPU Utilization of Smartfoxserver

Postby meanvel » 30 Mar 2017, 21:31

Lapo wrote:
meanvel wrote:Just a bit of advice. Running pathfinding or physics code serverside will result in a nightmare in server expenses. You will not be able to successfully keep a game online without hemorrhaging serious cash.

Not necessarily, pathfinding is not as heavy as physics stuff. Not even close.


Actually, any quality pathfinding method is pretty heavy. Take A*, then add mob cell to cell occupancy checks before movement and a path density alogo to spread out mobs and limit overlapping and you start burning CPU power fast. Of course, I do use extremely high mob density...

Even if it's only half the processing power of a physics engine, why do it? All your connected clients are essentially a free supercomputer available for data processing.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 77 guests