Memory usage grownup and server died

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

Moderators: Lapo, Bax

blindme
Posts: 7
Joined: 22 Nov 2013, 01:04

Memory usage grownup and server died

Postby blindme » 17 Mar 2014, 09:42

Hi.
I'm beginner about smartfox.

I'm writing very simple server extension and client stress tool.
In my server extension, do not perform any job.
Just a simple, empty server extension.
And, my stress tool, just connect, log in, create room and after join room, leave from it.
and loop from creating room again.

While checking internal test, I've found big problem.
Server uses more memory as time goes.
Slightly increase memory usage and... server died.

I don't know what the problem.
You can check
- server extension : https://drive.google.com/file/d/0B58j0l ... sp=sharing
- stress tool : https://drive.google.com/file/d/0B58j0l ... sp=sharing
- dash board capture : https://drive.google.com/file/d/0B58j0l ... sp=sharing

Please help me
User avatar
Lapo
Site Admin
Posts: 21779
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Memory usage grownup and server died

Postby Lapo » 17 Mar 2014, 11:59

I don't have direct access to those files.
It would be much easier if you could just zip them all into one single archive and upload it directly in the forum.
There is an "Upload Attachment" button right below the text box.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
blindme
Posts: 7
Joined: 22 Nov 2013, 01:04

Re: Memory usage grownup and server died

Postby blindme » 17 Mar 2014, 22:41

thank you.
I'll attach it.
Attachments
memory.png
memory usage
(163.86 KiB) Not downloaded yet
Makta.zip
server extension
(15.53 KiB) Downloaded 96 times
CBStress.zip
stress tool
(19.67 KiB) Downloaded 93 times
User avatar
YoungDeveloper
Posts: 34
Joined: 02 Mar 2014, 21:38
Location: Latvia

Re: Memory usage grownup and server died

Postby YoungDeveloper » 18 Mar 2014, 00:22

Hey, this is not case, but i cant mention that you should consider applying patch, as new version is 2.8.2
User avatar
Lapo
Site Admin
Posts: 21779
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Memory usage grownup and server died

Postby Lapo » 18 Mar 2014, 09:13

The Admin Screenshot doesn't show a memory crash. Did you actually get an OutOfMemory error or it's just the server that doesn't seem to respond?
I would recommend to check the status of the server queues during the test.
All Extension threads are working hard according to the thread monitor and it seems like you may need to increase the Extension threads.

Also you are using a database on the server side, and you are connecting all of the clients without any pause, inside a for loop. That's and unrealistic test to do. It may be good to stress test the system but the database query in comparison and your test will use up all the available threads.

You should read this document:
http://docs2x.smartfoxserver.com/Advanc ... hreadPools

I'd suggest to experiment with 10-20 threads for both the EventManager and ExtensionController so that you ensure enough scalability. Depending on the execution time of your DB queries you may need more threads.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 21779
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Memory usage grownup and server died

Postby Lapo » 18 Mar 2014, 09:16

As YoungDeveloper pointed out, you also seem to be running a fairly old version of SFS. It's a pre 2.7.0
I'd recommend upgrading to 2.7 and applying the latest 2.8.2 update patch as well.

This is not directly related with your problems but in general there have been several fixes and overall improvements in the latest releases.

In the next 2.9 version we'll introduce a new auto-balancing threading system that will remove the necessity to tinker with all those Thread settings :)

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
blindme
Posts: 7
Joined: 22 Nov 2013, 01:04

Re: Memory usage grownup and server died

Postby blindme » 18 Mar 2014, 09:32

when server not responses, there is logs like this.

java.lang.OutOfMemoryError: PermGen space ...

as your advice, I'll check your link and use new version of modules.

thank you all~~
User avatar
Lapo
Site Admin
Posts: 21779
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Memory usage grownup and server died

Postby Lapo » 18 Mar 2014, 09:49

PermGen is not related with the memory graph you have showed. That graph shows the usage of heap memory.

Long story short, Heap Memory contains the object you create at runtime. PermGen (permanent generation) Space is a different area of memory dedicated mostly to class definitions. In other words that's where Classes are loaded by Class Loaders.

It sounds like you are creating lots of Rooms with attached Extensions. Since every Extension is loaded in a separate Class Loader you may end up using lots of PermGen memory especially if you have other dependencies deployed with the Extension (DB drivers, 3rd party jars etc...)

Make sure all of your Extension dependencies are deployed in the extension/__lib__/ folder to avoid reloading them for every Room.

Also take a look here for more details on Class Loaders:
http://docs2x.smartfoxserver.com/Advanc ... extensions
Lapo

--

gotoAndPlay()

...addicted to flash games
blindme
Posts: 7
Joined: 22 Nov 2013, 01:04

Re: Memory usage grownup and server died

Postby blindme » 18 Mar 2014, 23:16

As you can see in my extension source code, only jars which linked with my extension are below

libs.png
jars
(20.56 KiB) Not downloaded yet


You mean, I must copy these jars to 'C:\Program Files\SmartFoxServer_2X\SFS2X\extensions\Makta' ?
User avatar
Lapo
Site Admin
Posts: 21779
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Memory usage grownup and server died

Postby Lapo » 19 Mar 2014, 09:15

No. I am saying the opposite. In the extensions\Makta\ folder just put your compiled extension jar.
All the dependencies (like the mysql jar etc...) should go in the extensions\__lib__\

Is this what you are doing?
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Aldenea, Baidu [Spider], DavinVicy, Kevengar and 38 guests