Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asynchronous database performance analysis #1883

Closed
synctext opened this issue Jan 20, 2016 · 6 comments
Closed

asynchronous database performance analysis #1883

synctext opened this issue Jan 20, 2016 · 6 comments
Assignees

Comments

@synctext
Copy link
Member

We now have blocking database IO. All database interaction is within the main twisted thread. It blocks, causing performance loss.

Events can be split in multiple parts. Events would continue when data has been retrieved, Twisted feature: https://twistedmatrix.com/documents/8.1.0/api/twisted.internet.defer.Deferred.html

Also, Lipu has an experimental branch using storm framework.

Task: benchmarking. Compare performance of various approaches, without full implementations (takes too much dev weeks).

@whirm whirm modified the milestone: Backlog Mar 18, 2016
@lfdversluis
Copy link

See #2137 :)

@synctext
Copy link
Member Author

As discussed today:

  • study Execute and ExecuteMany in Dispersy and Tribler
  • Create stress test job
  • serial IO thread in threadpool with inline deferred calls.

@synctext
Copy link
Member Author

synctext commented May 23, 2016

Work by @qstokkink
Tribler/dispersy@devel...qstokkink:threadeddb

This 2 weeks sprint contains operational multi-core Dispersy using Twisted.
40x speedup of sync experiment with 10 peers.

ThreadSafeExecute of Dispersy database access. Database requests become serialized. However, they can be requested from multiple Twisted threads! Tribler/dispersy@devel...qstokkink:threadeddb#diff-0d31758bc4ed14da7f82a5780aa66abdR38

Most of the speedup comes from a multi-core version of the Dispersy endpoint.py using Twisted: Tribler/dispersy@devel...qstokkink:threadeddb#diff-a694510bf8dca13af2bd89656ea772e0R210

@lfdversluis
Copy link

lfdversluis commented May 23, 2016

@synctext the reason this approach works is that it does not return a database item from _deep_copy_nts_db_call. it only returns the last inserted id or an iterator for the list generated by fetchall. The moment this returns a cursor it explodes :D Having said that, it looks well implemented in terms of synchronous code by making use of blockingCallFromThread, but note that this will block the reactor thread. http://twistedmatrix.com/documents/current/api/twisted.internet.threads.blockingCallFromThread.html

@synctext synctext assigned ichorid and unassigned lfdversluis Sep 11, 2018
@synctext
Copy link
Member Author

Update:
We aim to revisit this mega-task. After replacing Dispersy, deploying Giga channels, and Libtorrent wrapper re-write this is scheduled next.

@synctext synctext modified the milestones: Backlog, V9.9: Shadow Internet Sep 11, 2018
@synctext synctext modified the milestones: V9.9: Shadow Internet, Backlog Jul 14, 2020
@ichorid
Copy link
Contributor

ichorid commented Jul 16, 2020

Closed, as we should instead talk about particular databases, like Channels, or TC, etc.

@ichorid ichorid closed this as completed Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants