Skip to navigation
DigitalOcean Referral Badge

Get $200 credit on DigitalOcean

Hostinger logo

Hostinger: Lightning-fast hosting, unbeatable uptime, top-notch support!

Open extra topbar

Bitcoin and Altcoin Wallets plugin is now much faster

Bitcoin and Altcoin Wallets plugin is now much faster

Since version 6.0.0, the Bitcoin and Altcoin Wallets free WordPress plugin features an Object-Oriented model for manipulating Wallets, Currencies, Transactions, and Addresses. This means that writing custom code to implement your crypto business logic, is easier than ever before!

However this change has also meant heavier DB usage, as all these objects and fields correspond to SQL queries.

This is not a problem under light loads. But in situations with thousands of transactions, such as those created with the Airdrop extension, the plugin could become too slow.

Until now!

Batched SQL queries

In version 6.2.6, whenever the plugin loads batches of objects, it does so by executing only three SQL queries:

  • One over the posts table,
  • one over the post meta table,
  • and one for retrieving the tags (taxonomies table).

Compared to calling get_post_meta from the WordPress API for all object fields and for all objects, this new feature vastly reduces the amount of SQL queries needed.

This leads to the plugin responding faster.

Built-in object cache

To further cut down on SQL queries, the objects are cached into an internal object cache.

Again, cutting down the number of queries leads to an even faster plugin.

The new cache may somewhat increase memory usage, but according to my tests, not significantly.

This object cache can be turned off at: SettingsBitcoin & Altcoin WalletsGeneral settingsDisable built-in object cache (debug).

Airdrop transaction aggregation standalone script

If you have been running the Airdrop extension for a while, the database ledger will have accumulated a lot of transactions that can be grouped together to save space.

In severe cases this can make the plugin too slow.

Independent of the 6.2.6 release, I have also produced a script to group together old Airdrop transactions. It will group together airdrop transactions older than 1 month for each user and currency. The script will therefore reduce the size of the posts and postmeta tables.

This will make the plugin faster and the database smaller, while preserving the user balances. It is a standalone script, meaning that it requires ssh (shell) access to your WordPress machine.

If you are interested, the script is here:

https://gist.github.com/alex-georgiou/29ec4dd91b33e29e152de3cbeca2d48e

If you are planning to run this script, read the accompanying instructions carefully, or contact me.

Feedback

I have tested these changes and saw no adverse issues.

If you do spot any issues, or if you have any questions, please contact me at:

As always, I reply to all queries within 24 hours, Monday to Friday.

Comments:1

Leave a Reply

Your email address will not be published. Required fields are marked *