Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] [RSMB] Strange memory behavior

Hi Mohamed,

Yes exactly. If you don't want to copy the payload then you need
multiple buffers to be written to a single (or multiple) socket(s).
The first buffer is unique to the client, the second (the payload) is
not. My understanding is that using writev() is roughly equivalent to
a single call to write(), except that the data is stored in multiple
locations. If instead we use multiple calls to write(), we can end up
with the outgoing packets being fragmented unnecessarily.

Cheers,

Roger


On Tue, Oct 18, 2016 at 4:18 PM, Mohamed HAMZAOUI <requinham@xxxxxxxxx> wrote:
> Hi Roger,
>
> I didn't undertand your remark. I think writev() and WSASend() is used
> to write from several buffers to one socket. In fact, I am talking
> about sending the same data to several sockets without copy this data
> in process memory like Eclipse Mosquitto do.
> Can you explain to me if I misunderstood you.
>
> Regards,
> Mohamed
>
>
> On Tue, Oct 18, 2016 at 4:14 PM, Roger Light <roger@xxxxxxxxxx> wrote:
>> Hi Mohamed,
>>
>> Of course that is possible. That does mean writing the outgoing
>> message in multiple calls to write() though. When I've done this is
>> the past it has resulted in the message being split over multiple tcp
>> packets even when not necessary, so a single byte payload for example
>> is suddenly a whole lot less bandwidth efficient.
>>
>> The solution is to use writev(), but this isn't portable. The roughly
>> equivalent Windows call is WSASend(). This just hasn't been looked at
>> yet.
>>
>> Cheers,
>>
>> Roger
>>
>>
>>
>> On Tue, Oct 18, 2016 at 1:22 PM, Mohamed HAMZAOUI <requinham@xxxxxxxxx> wrote:
>>> Hi Roger,
>>>
>>> I just checkout master git on https://github.com/eclipse/mosquitto and
>>> when testing the last working version, I detect this behavior :
>>> 1- At starting the broker allocate 37240 KB of virtual memory and 4756
>>> of resident memory (in the last version just 4340 virtual and 1360
>>> resident)
>>> 2- When transferring my message of 100 MB, the memory peak is about
>>> 242048 for one publisher and one subscriber and about 550 MB for one
>>> publisher and 4 subscriber. It's not bad compared to latest version
>>> but I think there are a means to marshal message from only one
>>> instance in memory ?
>>>
>>> Regards,
>>> Mohamed
>>>
>>>
>>>
>>> On Tue, Oct 18, 2016 at 12:54 PM, Roger Light <roger@xxxxxxxxxx> wrote:
>>>> Hi Mohamed,
>>>>
>>>>> I don't understand exceeding 300 MB to transfer 100MB message size
>>>>> between one publisher and one subscriber ! Then I tried to test RSMB
>>>>> code but more problems.
>>>>
>>>> This is down to some unnecessary copying of the payload which is
>>>> already changed in the development branch.
>>>>
>>>> Cheers,
>>>>
>>>> Roger
>>>> _______________________________________________
>>>> mosquitto-dev mailing list
>>>> mosquitto-dev@xxxxxxxxxxx
>>>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>>>> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
>>> _______________________________________________
>>> mosquitto-dev mailing list
>>> mosquitto-dev@xxxxxxxxxxx
>>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
>> _______________________________________________
>> mosquitto-dev mailing list
>> mosquitto-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
> _______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top