Hi Emmanuel,
Thanks for the prompt reply. I appreciate it.

I conducted a test - I created a client that connects to a server through the 
proxy.
The client reads from a file and sends 10kb chunks. 
Using debugger, I noted that the server receives the data as it sent from the 
client. Maybe I'm mistaken but it means that message will NOT have to be fully 
received in order to be written to the server.

Unless I misinterpret what I'm seeing, it looks like the IoBuffer (from 
AbstractProxyIoHandler#messageReceived) does not get bigger 

This is the IoBuffer state during the data transfer (from 
AbstractProxyIoHandler#messageReceived):
HeapBuffer[pos=0 lim=1024 cap=1024: 30 36 2F 30 36 2F 31 37 20 31 39 3A 31 33 
3A 33...]
HeapBuffer[pos=0 lim=2048 cap=2048: 69 74 69 6E 67 20 66 6F 72 20 6E 65 78 74 
20 69...]
HeapBuffer[pos=0 lim=4096 cap=4096: 74 68 72 65 61 64 2D 38 37 5D 20 4D 65 73 
73 61...]
HeapBuffer[pos=0 lim=3072 cap=8192: 69 6F 50 72 6F 63 65 73 73 6F 72 2D 32 5D 
20 53...]
HeapBuffer[pos=0 lim=8192 cap=8192: 75 65 73 74 44 65 63 6F 64 65 72 20 2D 20 
56 65...]
HeapBuffer[pos=0 lim=2048 cap=16384: 73 73 61 67 65 20 6C 65 6E 3A 20 32 38 31 
0D 0A...]
HeapBuffer[pos=0 lim=10240 cap=16384: 73 73 61 67 65 73 20 6F 66 20 31 32 30 31 
31 34...]
HeapBuffer[pos=0 lim=10240 cap=16384: 6F 72 20 6F 72 69 67 69 6E 61 74 6F 72 20 
32 30...]
HeapBuffer[pos=0 lim=10240 cap=16384: 65 64 20 6D 65 73 73 61 67 65 20 6C 65 6E 
3A 20...]
HeapBuffer[pos=0 lim=10240 cap=16384: 74 69 6E 67 20 66 6F 72 20 6E 65 78 74 20 
69 6E...]

Hope this helps.

Many thanks,
Guy

-----Original Message-----
From: Emmanuel Lécharny [mailto:elecha...@gmail.com] 
Sent: Monday, June 12, 2017 3:43 PM
To: users@mina.apache.org
Subject: Re: Proxy example memeory usage going high

Hi,


Le 12/06/2017 à 11:31, Guy Itzhaki a écrit :
> Dear all,
>
> We are using the proxy example using mina 2.0.15. 
>
> At the beginning everything looks good, but when we tried to funnel a 
> 1GB file the Proxy memory went high till the proxy doesn't receive new 
> connections.
>
> This is strange because I was expecting that every buffer will be 
> cleared once it is sent, so the proxy will not consume too much memory.

This is a really rough implementation of a proxy. Typically, messages will have 
to be fully received in order to be written to the remote server, which means 
we hold it in memory until it's fully received. If you process 1Gb messages, 
then expect at least 1Gb of memory to be ate in the process (actually, expect a 
*lot* or reallocation during the message reception, as MINA will have to resize 
the buffer receiving the
data...)

In other words, you'll have to rework the example to fit your need.

--
Emmanuel Lecharny

Symas.com
directory.apache.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to