Closed justincpresley closed 8 months ago
Hello. Due to time conflict I have to delay it to next week. Things that may be slow are:
prepare_data
signs every packet. It is the most time consuming part, especially if you use an RSA key.python-ndn
's encoding is totally written in Python, so the encoding of long Names can take a long time.
Have you tried pypy3? Due to my experience it can be much faster with encoding.
Also, if you need some "official" performance benchmark on encoding, refer to https://github.com/zjkmxy/ndn-encoding-test/blob/main/performance_results.md.Hello. After some investigation I think the most time consuming part is signing. Preparing data packets with SHA256 hash only takes about 2s but with an ECC key will take 40s.
Here is the calling graph showing the hot path:
Since there is nothing I can do for this specific performance issue (prepare_data
), I will close the issue for now.
OS: Ubuntu 20.04 Forwarder: NFD Problem: When using python-ndn to form data packets from 8000-sized byte chunks (streamed from a FTP server), I have found that app.prepare_data() is really expensive or has poor performance.
When testing it with 100MBs, to just stream the file and write the bytes to disk, It takes 1.99 seconds to complete. Doing that same process but just preparing each chunk using app.prepare_data() (doing nothing with the chunk for comparison reasons), It takes 36.75 seconds to complete. In addition, this scales with the data size which is logical as I am calling prepare_data() more. Is this expected? Is there something in particular that makes prepare_data take awhile? Any alternatives to prepare_data?
I tested this using the script below. If you run it yourself, you will have to setup a file server using vsftpd and create a guest user which has /files/mbstest at the home directory.