Forgottenserver: Support for multiple ASIO threads

Created on 26 Mar 2017  路  2Comments  路  Source: otland/forgottenserver

ASIO threads currently spend most of their time performing XTea decryption/encryption. It might be worth allowing multiple threads to execute asio::io_service::run() to parallelize execution of XTea for multiple clients.

Requirements :

  • all functions called within ASIO completion handlers MUST be thread-safe.
  • investigate the impact of #1466 on having multiple ASIO threads
enhancement

Most helpful comment

I have vectorized code for XTEA and it could improve performance by up to 8x. I will open a PR soon.

All 2 comments

There is two details that must be addressed:
Dispatcher also waste time doing xtea encryption. Its happens when dispatcher calls Connection::send and there is no msg in the queue(the dispatcher will call Connection::internalSend to do the encryption and async asio send).
Another thing is that inside ProtocolGame::onRecvFirstMessage there is some calls to IOBan and IOLoginData functions that uses the main database connection. The main database connection has a lock which means if dispatcher is using the database connection the ASIO thread will waste time waiting the lock to be release.

I have vectorized code for XTEA and it could improve performance by up to 8x. I will open a PR soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GoularPink picture GoularPink  路  4Comments

EPuncker picture EPuncker  路  4Comments

GoularPink picture GoularPink  路  3Comments

MillhioreBT picture MillhioreBT  路  4Comments

irenicus30 picture irenicus30  路  5Comments