-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Massive performance improvement... #363
base: master
Are you sure you want to change the base?
Conversation
... over large chains. Added indexes and brought back last_txs setting (set to 0 will display the whole chain in the index, but without sacrificing server or mongo performance).
Ah sorry, that was a debug, I will fix it. |
OK I have put back the correct port settings, sorry about that. |
Do you want me to set it back to countDocuments ? |
I'm not entirely sure yet. I need to go through and double check its usage. My fear is improper shutdowns will cause the count to be off, but this is simply the total count of txes for an address. It's not something I deem mission critical compared to say the actual values of transactions/amounts/etc. Performance wise, count is indeed much faster, but it's also susceptible to inaccuracies. |
That's exactly what I thought. It's the same as count without lock on MySQL InnoDB, the count is not accurate but is very fast. In this case, worst that can happen is the the page number display is not accurate. But transactions per address are slow, I guess we could live with that given the cost of the countDocuments(). |
I agree. I would however counter to provide a settings config so that explorer admins can choose to have accuracy. The performance impact from if/then statements would be negligible. |
Any update on the ETA of this pull request being finalized and merged? Also, @typhoonsimon where does the need come to index both descending and ascending directions, does it really give the desired result?
|
I'm going to add this to my testing and merges with uaktags:explorer#58. Once testing is complete, I'll push accept and merge this. Hopefully end of week for an eta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per my comments this needs adjusting and/or duplicating into latest TX and latest BLOCK function calls
@@ -27,7 +27,7 @@ html | |||
function update_stats(){ | |||
$.ajax({url: '/ext/summary', success: function(json){ | |||
$("#supply").text(parseInt(parseFloat(json.data[0].supply).toFixed(0)).toLocaleString('en')); | |||
$("#difficulty").text(parseFloat(json.data[0].difficulty).toFixed(2)); | |||
$("#difficulty").text(json.data[0].difficulty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we changing this? If you want this formatted differently then we should add config options for it in a separate PR
Edit: sorry my fault I broke this for hybrid diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b7180dc
}); | ||
}, function() { | ||
exit(); | ||
|
||
// insert all at once after creation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good, much better way of doing it
return cb(txs, count); | ||
} | ||
}); | ||
lib.get_blockcount(function(blockcount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@typhoonsimon As per the function's name "get_last_txs_ajax" - this function does NOT show latest blocks - it shows Latest Transactions, we cannot use the blockcount call here.
This does look very efficient though and would work almost as is for an additional function for latest blocks, which we could then set in the config for the user to display latest TX or latest BLOCKS on the front page.
In terms of making this code work for latest TXs what's the performance difference of Tx.countDocuments vs Tx.count here?
tx_count might be a stat we should keep updated via block indexing?
Merged the index declarations to 'main' here: 3f81b75 - these alone seem to have improved paging performance for me so thanks for that @typhoonsimon |
d611f8f This patch seems to add a mild speed improvement until we resolve this PR but thanks for your help so far @typhoonsimon |
Difficulty display fixed: b7180dc |
.. for index page and address view page. Don't forget that these additional mongo indexes must be created to achieve the level of performance of http://lcp.altcoinwarz.com/