Skip to content

Fix #2478: using tbb::concurrent_unordered_map for VC lookup - #2555

Closed
zizhong wants to merge 1 commit into
apache:quic-latestfrom
zizhong:quic_2478
Closed

zizhong wants to merge 1 commit into
apache:quic-latestfrom
zizhong:quic_2478

Conversation

@zizhong

@zizhong zizhong commented Sep 21, 2017 •

Copy link
Copy Markdown
Member

trying to fix #2478.

Introducing a new dependency, tbb, for ATS. build works for rhel7. didn't test on other systems. First time modifying automake scripts. Please feel free to leave your ideas and suggestions! @maskit @masaori335 @bryancall @zwoop @SolidWallOfCode
cc @sidhuagarwal

@masaori335

Copy link
Copy Markdown
Contributor

I could build and run this PR on Mac with TBB installed via homebrew. The license of TBB is Apache License 2.0 ( https://github.com/01org/tbb/blob/tbb_2018/LICENSE ). It's OK.

@masaori335

Copy link
Copy Markdown
Contributor

The docs of tbb::concurrent_unordered_map says

concurrent_unordered_map and concurrent_unordered_multimap support concurrent insertion and traversal, but not concurrent erasure. The interfaces have no visible locking. They may hold locks internally, but never while calling user-defined code.

So, we can concurrently insert and find connection id if there're no on going erasure, right?

@zizhong

zizhong commented Sep 22, 2017

Copy link
Copy Markdown
Member Author

@masaori335 Awesome! Thanks for your confirmation!
For the second comment, yes, that's my understanding.

@masaori335

masaori335 commented Sep 22, 2017 •

Copy link
Copy Markdown
Contributor

@zizhong Sounds great! In many cases, multiple QUICPacketHandler on UDP threads can access this map concurrently.

@maskit maskit added the QUIC label Sep 22, 2017
Comment thread configure.ac Outdated
#
TS_CHECK_TBB
if test "x${enable_tbb}" != "xyes"; then
AC_MSG_ERROR([Cannot find tbb library. Configure --with-tbb=DIR])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check shouldn't cause an error but QUIC should be enabled only if TBB is available (same approach as the check for TLS 1.3) until we use it in core.

@maskit

maskit commented Sep 22, 2017 •

Copy link
Copy Markdown
Member

@zwoop Any idea why this PR doesn't have test results on CI? (I know it doesn't run tests for QUIC code but it have ensured that code is formatted well and changes don't break build without TLS 1.3.)

@dragon512

Copy link
Copy Markdown
Contributor

I am good with this. However we will want to test with TBB alloc now as these data structures have been optimized for speed with the TBB allocators. Just another options the memory allocator.
I strongly suggest we use the latest drop when we can. https://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes

@zwoop

zwoop commented Sep 22, 2017 •

Copy link
Copy Markdown
Contributor

This is a pretty significant change, and I don' think we should land this without further considerations.

  1. This should be discussed on the mailing list, and perhaps even the Summit. A hard requirement on TBB is a tough pill to swallow.

  2. I suspect, but see 1), that we might need to include TBB in our source tree. The burden on building ATS becomes pretty significant otherwise, some modern distros might have some versions of TBB, but I have not investigated all platforms we support. It also becomes a nightmare on versioning.

Also, big changes like including / replacing core pieces of ATS ought to be done carefully, and with appropriate performance benchmarks and metrics. Of which we have none (or very little).

@PSUdaemon

Copy link
Copy Markdown
Contributor

I agree with @zwoop. This is a huge dependency to land in such a manner. We still have a dependency on TCL for a similar use case. We have also actively attempted to lower dependencies on large generic libraries like this, ie Boost. We should very carefully consider this course of action.

@SolidWallOfCode

Copy link
Copy Markdown
Member

@zizhong @masaori335 I presume the table is never cleaned because it gets in toto when the connection is terminated?

@dragon512

Copy link
Copy Markdown
Contributor

I don't disagree with getting data. All I can say is the difference with TBB and Boost is that boost is a random set of stuff to solve problem, not concerned with speed or efficiency. TBB is all about standards and performance. Given @zwoop concerns about performance, the people that work on this care about performance as TBB is used in all the Performance libraries as MKL, OpenMP, and others from Intel. Ideally we can remove TCL depends as TBB as a collection to solve the TCL hash table problem. We can get the source as add it to our tree is we need to.. it is all apache license

@zizhong

zizhong commented Sep 22, 2017

Copy link
Copy Markdown
Member Author

@SolidWallOfCode Correct. We don't need to be worried about the cleanup. The packet_handler is associated with a UDPConnection. When the connection is gone, it will free the handler, including the map.
@masaori335 @maskit Currently, we don't erase the entry when QUICConnection is gone also. Could it become a problem when receiving a packet with a cid pointing to a terminated QUICConnection?

And yes, I couldn't agree more that we need to be super careful about adding this kind of large dependency to ATS. Thanks, @zwoop, @PSUdaemon for bringing that up.
Also, thanks, @dragon512 for the insightful comments on TBB and TCl.

@masaori335

Copy link
Copy Markdown
Contributor

@SolidWallOfCode Correct. We don't need to be worried about the cleanup. The packet_handler is associated with a UDPConnection. When the connection is gone, it will free the handler, including the map.

Hmm, I agree basically, but the scenario is little bit different from my understanding. QUICPacketHandler is associated with UDPNetProcessor not UDPConnection. So when the connection is gone, this table is still there.

@masaori335 @maskit Currently, we don't erase the entry when QUICConnection is gone also. Could it become a problem when receiving a packet with a cid pointing to a terminated QUICConnection?

That is on our todo list. We need to erase the entry, but we haven't implemented yet. ( One of the reasons is Map doesn't have API to remove entry. So, anyway we need to change the data structure of this table. )

@zizhong zizhong changed the title [#2478] using tbb::concurrent_unordered_map for VC lookup Fix #2478: using tbb::concurrent_unordered_map for VC lookup Sep 25, 2017
@zizhong

zizhong commented Sep 27, 2017

Copy link
Copy Markdown
Member Author

Oh. @masaori335 is right. We never clean up the QUICPacketHandler. So the table will continue growing, which will be changed in the future I believe.

@zizhong

zizhong commented Sep 28, 2017

Copy link
Copy Markdown
Member Author

updated the PR as @maskit suggested.

@bryancall

Copy link
Copy Markdown
Contributor

This PR hasn't been updated in more then 2 months and I am closing out PRs that haven't had any updates. I don't think we want to pull in TBB at this point.

@bryancall bryancall closed this Feb 7, 2018
@zwoop zwoop modified the milestones: 8.0.0, QUIC Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants