Author Topic: memory usage problem  (Read 8150 times)

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
memory usage problem
« on: May 21, 2014, 02:17:32 AM »
50+ clients online test ,I found some problems.

 1- use more and more memory,
 memory usage increase  constantly..
serveral hours later,,consume 10gb memory
client has the same tendency..

2-when a lot.of   clients  connected,, new client hard to connect to server..delay ...

3-if one client disconnect ,sometimes server lost all the client,means all clents disconnect because one player leave...the more client connect,the more easiler happen.

any way to solve??thanks...
« Last Edit: May 21, 2014, 06:31:54 AM by erictang01 »

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #1 on: May 21, 2014, 04:04:36 AM »
all  clients  disconnect ...

the memory of server still there...

not release....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: memory usage problem
« Reply #2 on: May 21, 2014, 01:46:44 PM »
What do you do in your server? I have 4 of them running on a single Amazon EC2 micro instance and they take anywhere from 5 to 16 megabytes of memory. Two of them have been active for the past 10 months straight.

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #3 on: May 21, 2014, 07:13:33 PM »
The original server program
Not modified
client test, connect server join a channel ,and autocreate a third person character,Random walk..and autosync position...

yes,16 megabytes of memory under 50 clients Stably

but when I open 70-80 clients ,check after 10min,memory usage up to 1Gb.and gradually increase over time

and then ping is high (LAN test)..




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: memory usage problem
« Reply #4 on: May 21, 2014, 09:45:32 PM »
You must be doing something else there, like creating persistent channels and sending persistent RFCs full of large amounts of data. I can think of absolutely nothing on the server side that would cause the memory to grow and never go down. Remember, you can always run the server from within Visual Studio to debug what's going on.

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #5 on: May 21, 2014, 10:08:56 PM »
I think so ,
I just create one channel,

and create a character every client ,sync the position each other.there is no problem under 60character,

is there too many character in a channel ?so that sending too much data to the server,

Server can not afford to handle,and then cache data .and no load balance. so that memory increase constantly,right?

can u give me some suggestion about peak value data.?

toreau

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: memory usage problem
« Reply #6 on: May 22, 2014, 02:23:14 AM »
Can you show us some code? Also, which platform is your server running on?

I also find this statement particularly interesting:

Quote
if one client disconnect ,sometimes server lost all the client,means all clents disconnect because one player leave...the more client connect,the more easiler happen.

By "disconnect", do you mean if the client just quits the application? What happens if you bind "Q" to a proper disconnect inside the application? Same behaviour?

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #7 on: May 22, 2014, 03:12:03 AM »
no modify.
just the example  from package..

run on window server 2008 r2

client  quit the application  to disconnect ...

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #8 on: May 22, 2014, 03:19:00 AM »
Can you show us some code? Also, which platform is your server running on?

I also find this statement particularly interesting:

By "disconnect", do you mean if the client just quits the application? What happens if you bind "Q" to a proper disconnect inside the application? Same behaviour?


use cmd  to  close process quickly.and then server shut down..

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: memory usage problem
« Reply #9 on: May 22, 2014, 04:25:41 PM »
Are you creating all 60+ instances of Unity on the same exact computer?

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #10 on: May 22, 2014, 08:13:54 PM »
Are you creating all 60+ instances of Unity on the same exact computer?

yes...something wrong?

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: memory usage problem
« Reply #11 on: May 23, 2014, 10:11:19 AM »
Try recording how much memory it uses with one game. then two games. then 5 games. and so on.

You're really pushing your computer if you have 60 instances running on one computer.

toreau

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: memory usage problem
« Reply #12 on: May 23, 2014, 01:19:13 PM »
I agree with djray2k; it seems like you hit some kind of treshold, and it could easily be your OS doing things in the background that TNet has no control over.

Are you sure that the TNet server and the clients are using all the memory? Could it be other processes?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: memory usage problem
« Reply #13 on: May 23, 2014, 05:56:20 PM »
60 instances of Unity on the same computer... Let's do some math. TNet's stand-alone example takes 32 megabytes of memory. 60 of them means nearly 2 gigabytes of memory, and that's with nothing in them. Each one by default is eating as much CPU time as possible, so your machine must be clawing for resources, slowing the response time of everything. Furthermore having this many active open sockets on the same computer just about guarantees you completely flooding the network with packets, effectively bottle-necking the server and making it unable to send out anything. The operating system force-freezes outgoing packets if you flood the network, forcing all data to be cached instead, resulting in all that you're sending to sit there, waiting in memory instead of being sent out. This obviously bloats memory usage further.

Bottom line... you can't run so many instances of Unity on the same computer.

erictang01

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: memory usage problem
« Reply #14 on: May 25, 2014, 07:09:49 PM »
I try to use 4 computers to do it.but the same result...