[nanomsg] Re: why memcpy data to be sent?

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 29 Oct 2014 05:44:32 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Matthew,

> This is precisely the same sort of issue I was reporting a few
> weeks ago.
> 
> I am working on a security sensor with a user-space network stack
> to eventually scale to 10's of gigabits, and I want to report
> threat matches via nanomsg using input from a non-default memory
> allocator.
> 
> Right now you can't instruct nanomsg to zero-copy from your
> provided prebuilt buffer, and send it out.
> 
> So my app ends up working like this:
> 
> 1) Find data inside special Huge TLB Pages of network packets.
> 
> 2) Create threat report using serialization library (causes
> gathering copy from few spots in packets).
> 
> 3) Serialize threat report to buffer in serialization library (need
> to hack it eventually to remove this copy).
> 
> 4) Nanomsg wants to make a copy to do its send. Instead I'd like to
> be able to have it use my buffer for the send, and callback my
> custom_buffer_free(void*) to return it to my pool.
> 
> So it's a lot of work to remove all these copies, and past
> experience has shown the hit they cause is painful when you are
> writing a high-speed app like mine is going to be.

I feel your pain, but adding callbacks to the existing POSIX API isn't
a good idea.

Let's rather think about how to make customising nanomsg to do
deallocation in a different way easier.

Martin





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJUUHCwAAoJENTpVjxCNN9Y4O0H/1K0CtLE31z/9mUvT9P0ZyM5
C9Yv7cBT0vfk8pqQnjHzRsEdIBZwY4oAcBqxMPEJZbXrFZy4uTv1lX58IEXMAPT/
cV5KwMRrC+iQB/YC6G248wl7DyfK5r5zvlqByfL5dEseywk+QYCnLqhhrkT3D+L2
fLC9fg2HeC/qSkuASNL6kL0sJoKxNnRnCfu4B57C4QJ7OVs2jn0tqorE6zLiPGHu
dYKh6SLt5R5t7S/KJkGSrNasU4/46AfLz00Lc2Gttt+0xAmeGXe63gOR8LdTf9si
dr/9uLLhgqMO7Kq5BsQk07GXLE3aoncrH5AWU7g9QZCr7MFzCHtfhtC+IJMKt7s=
=NIYb
-----END PGP SIGNATURE-----

Other related posts: