WaterSweet / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

Too many memory occupied by mochiweb when there are large number of connection. #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
CentOS 5.3  X86_64

Please provide any additional information below.
There are more than 8G memory occupied by mochiweb when i made 100K http 
connection to the server. is there any way to reduce the memory occupied?

It seems that is not possible if i want to support large connection with 
limit memory . I have  profiled the memory consumption, every process 
occupied around 80K memory, most of them is occupied by process heap ,which 
means it  should be GC in the soon future. 

I got a solution for this issues, if one process can manage more than one 
connection, it is possible to manage large connection with limited memory. 
is this solution work???

Original issue reported on code.google.com by tatez...@gmail.com on 8 Jul 2009 at 2:20

GoogleCodeExporter commented 8 years ago
You won't be able to have one process manage more than one connection, but you 
can add GC calls and change 
the default heap size of your processes.

Original comment by bob.ippo...@gmail.com on 8 Jul 2009 at 2:33

GoogleCodeExporter commented 8 years ago
The only thing i can specify the heap size of my process is minmun heap size by 
flowing code 

process_flag(min_heap_size, MinHeapSize)
This changes the minimum heap size for the calling process.

acctually , i wrote a gateway using erlang, i need to handle large number 
client 
connections with limit memory. the solution is one process manage mulitiple 
sockets. 
a group of sockets send data to the same process , process distinguish the 
message 
by source socket reference.

Original comment by tatez...@gmail.com on 8 Jul 2009 at 2:47

GoogleCodeExporter commented 8 years ago
That approach isn't appropriate for the mochiweb project

Original comment by bob.ippo...@gmail.com on 8 Jul 2009 at 2:51

GoogleCodeExporter commented 8 years ago
5555  , but how can i work around my issues?? does we pyhisically need so many 
memory?? does any other mochiweb users reportted the same issue of mine?

Original comment by tatez...@gmail.com on 8 Jul 2009 at 3:00

GoogleCodeExporter commented 8 years ago
http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-p
art-1/

Original comment by bob.ippo...@gmail.com on 8 Jul 2009 at 3:02

GoogleCodeExporter commented 8 years ago
I have read this article for times. acctully , this article inprited me to do 
the 
socket-shared-process things. My wonder is that why this solution is not 
appropriate 
for mochiweb project ??

Original comment by tatez...@gmail.com on 8 Jul 2009 at 3:17

GoogleCodeExporter commented 8 years ago
Because it changes the programming model.

Original comment by bob.ippo...@gmail.com on 8 Jul 2009 at 3:20

GoogleCodeExporter commented 8 years ago
That is a good answer. if we can back to years ago, there is no mochiweb , and 
, we 
dicide to develop a mochiweb, do you think , The socket-shared-process  is a 
solution to consider? 

or it is totally break the roles of erlang programming??

Original comment by tatez...@gmail.com on 8 Jul 2009 at 3:28

GoogleCodeExporter commented 8 years ago
If I wrote mochiweb over again, I would choose the same programming model. It's 
a trade-off, I'm willing to 
allocate a few KB per connection in my applications in exchange for an easy to 
use programming model. For 
your applications the constraints might be different.

Original comment by bob.ippo...@gmail.com on 8 Jul 2009 at 3:36

GoogleCodeExporter commented 8 years ago
Thank you for your patient and your help. 

Original comment by tatez...@gmail.com on 8 Jul 2009 at 3:43