haveno-dex / haveno

Decentralized P2P exchange platform built on Monero and Tor
https://haveno.exchange
GNU Affero General Public License v3.0
983 stars 110 forks source link

Provide reports on Haveno's performance[ɱ2] #20

Closed woodser closed 2 years ago

woodser commented 3 years ago

Haveno's Java backend currently consumes significantly more computing resource than is necessary.

For example, performance analysis revealed the Bisq DAO to consume significant resources which will be resolved when the DAO is removed.

This issue requests detailed reports on Haveno's current resource usage in order to achieve significant performance improvements.

Specifically requested is a list breaking down top time consumers while running the application, including references to related code in order to inform where optimizations are needed and focus developer effort.

For example, this performance analysis on Monero's daemon breaks down time consumers and related code: https://github.com/monero-project/monero/issues/7913#issuecomment-909707754

There are many tools to analyze performance of a Java application like JVM Monitor built into Eclipse or VisualVM.

erciccione commented 3 years ago

@haveno-dex/developers this is a good issue to start with.

cirocosta commented 3 years ago

tip: flamegraphs are tremendously useful - https://netflixtechblog.com/java-in-flames-e763b3d32166

github-actions[bot] commented 3 years ago

There is a bounty on this issue, the amount is in the title. The bounty will be awarded to the first person(s) who resolves this issue. Read the full conditions in the 'bounties.md' file. If you are starting to work on this issue, please write a comment here, so that we can assign the issue to you and avoid duplicated work.

ghost commented 3 years ago

tip: flamegraphs are tremendously useful - https://netflixtechblog.com/java-in-flames-e763b3d32166

I ran the perf command on "alice" in the guide at https://github.com/haveno-dex/haveno/blob/master/docs/installing.md

You can find the svg flamegraph at https://github.com/M0ner0Mum/haveno-performance

erciccione commented 3 years ago

Hello @M0ner0Mum. Thanks for the chart. Note that to receive the bounty we need more details:

Specifically requested is a list breaking down top time consumers while running the application, including references to related code in order to inform where optimizations are needed and focus developer effort.

Also, a chart with that level of zoom and no comments is not really useful.

chaserene commented 3 years ago

I'm bumping the bounty to 2 XMR (1.5 XMR from me).

woodser commented 2 years ago

The report should be run before and after removing the DAO with https://github.com/haveno-dex/haveno/pull/121.

agg505 commented 2 years ago

I monitored cpu consumption for the app in idle state without DAO. By VisualVM and JMC, we can see the top consumer threads and methods. And I'll make up reports for app and seednode with and without DAO if this kind of report is ok.

微信截图_20211021101304 微信截图_20211021101538

woodser commented 2 years ago

Nice to see early results that JFX is a top consumer, since Haveno won't use JFX for frontend.

In case you haven't, please disable animations under settings to minimize JFX from the results as much as possible.

The DAO has been removed with this commit, but yes it would still be helpful to know if DAO removal makes any difference in the measurements.

It would be helpful to see more about what the "Peer..." operations are, which I assume more details will be shown in the forthcoming reports. Otherwise this kind of report looks good to me.

Can you please document the steps you took to generate the report? It would be great for developers to easily generate them.

agg505 commented 2 years ago

Got it, and I'll feedback later.

agg505 commented 2 years ago

微信截图_20211022095341 微信截图_20211022095353 微信截图_20211022095403

erciccione commented 2 years ago

@agg505 Could you update the results in a readable document in one of our repositories (probably haveno-meta would be best) with a pull request?

Please consider that we are paying >$500 for this task. Simply taking screenshots of an app is not enough, we would like to have a more detailed and easily readable overview.

agg505 commented 2 years ago

@erciccione Please have a check https://github.com/agg505/haveno-meta/blob/master/haveno-performance-report.md , and I'll create pull request if it's ok.

erciccione commented 2 years ago

The file looks good, the only thing missing is the flamegraphs. Could you add them in a resolution similar to the example here https://github.com/haveno-dex/haveno/issues/20#issuecomment-820511278 ?

woodser commented 2 years ago

I agree the flamegraphs would be helpful to visualize everything, but it's clear that JFX is the dominant consumer, especially considering that QuantumRenderer is also part of JFX.

I think with the flamegraphs and documentation to regenerate these reports in the future, these reports are sufficient. We'll need to re-profile the application running as a daemon when it's closer to production-ready (as a separate issue in the future).

agg505 commented 2 years ago

@erciccione I made up some flame graphs in a new section "Flame Graphs for Some Thread Types", please check them here: https://github.com/agg505/haveno-meta/blob/master/haveno-performance-report.md

erciccione commented 2 years ago

That looks very good, thanks. Please go ahead with the pull request :)

agg505 commented 2 years ago

Thanks and the PR is here: https://github.com/haveno-dex/haveno-meta/pull/12

erciccione commented 2 years ago

https://github.com/haveno-dex/haveno-meta/pull/12 is merged. @agg505 please provide us with an xmr address :)

agg505 commented 2 years ago

@erciccione I confirm my wallet address starts with '4594' and ends with 'wLCd

erciccione commented 2 years ago

2 XMR Sent. @agg505 please confirm you have received the coins.

agg505 commented 2 years ago

@erciccione I have received the XMRs, thank you!

erciccione commented 2 years ago

Thank you. Hopefully we will see you around again :)