named-data / python-ndn

An NDN client library with AsyncIO support in Python 3
https://python-ndn.readthedocs.io/en/latest
Apache License 2.0
24 stars 17 forks source link

Adding NDN-DPDK Forwarder Support #48

Open justincpresley opened 2 years ago

justincpresley commented 2 years ago

Hey! So I have a use case to support the NDN-DPDK forwarder. As you may know, ndn-hydra is an distributed repository built using this library. It is soon going to be deployed (and actively used) on a high-performance environment. However, our forwarder is a major bottleneck in initial testing.

I did look into how tightly coupled NFD is with this library and it looks to be extensive. However, if NDN-DPDK becomes supported, I am able to advertise NDN to a broad audience. This also would allow NDN (Hydra) to be actively used to solve problems which would popularize NDN.

Simply said, NDN-DPDK forwarder support would greatly help our application in solving the problem it is trying to solve and as a major user of this library, I would greatly appreciate it if this was included.

zjkmxy commented 2 years ago

Hello. I think the only problem is PIT token. python-ndn does not memorize incoming Interests so it does not apply PIT token when a data is sent. This is hard to fix.

yoursunny commented 2 years ago

For PIT token, it isn't necessary for the library to memorize incoming Interests in a PIT. Producer handler should be given a reply function, which memorizes the current Interest including its PIT token.

@app.route('/P')
def process_interest(interest: Interest, reply: Callable[[Data|Nack|None], None]):
  # to reply with Data
  reply(data)

  # to reply with Nack
  reply(nack)

  # to not reply i.e. cause a timeout
  reply(None)

NDNph library has a similar design, but does not have all the features listed above. https://github.com/yoursunny/NDNph/blob/22e703555503c2d534774064d9bb444ee8011cbf/src/ndnph/app/ping-server.hpp#L36

zjkmxy commented 2 years ago

Thank you for your idea. Will implement this when I have time.

yoursunny commented 2 years ago

Proper NDN-DPDK support has 3 ingredients:

For memif transport, build a Python extension based on libmemif C library. This should be a separate library that is an optional dependency of python-ndn. I have a Node.js memif library for reference.

For management protocol, NDN-DPDK natively accepts GraphQL commands, but some deployments use Multiverse that uses a different protocol. NDN-DPDK does not have a listening socket; both face creation and prefix announcement need to go through an out-of-band management protocol. See NDNts @ndn/dpdkmgmt for reference, but the GraphQL commands may still change.

zjkmxy commented 2 years ago

This involves multiple changes in NDNApp. I think probably I should refactor the whole class (like NDNAppv2). Since this takes time and is not of high priority, let me delay this work for now.