[bisq-network/bisq-markets] replace apcu caching with opcache and re-enable caching. (#13)

peertrade notifications at github.com
Tue Jul 10 03:47:30 UTC 2018


This PR uses PHP's builtin opcache extension to cache Bisq's large JSON files between http requests, instead of the apcu extension which was slow and previously disabled.

Opcache is intended for caching PHP code files.  This patch uses a little trick to write out the JSON data structures as "php code" to a file on disk, and then each cache read calls PHP's include() function to read the file, which internally accesses the parsed data from RAM rather than from disk.  The pre-existing caching logic in filecache.class.php is smart enough to invalidate the cache key whenever one of the Bisq JSON files is updated by the Bisq java app.  Thus, the cache never gets stale.

In local testing on a laptop the /trades api went from approx 25 requests/sec to 1450 reqs/sec and front page load from about 20 reqs/sec to 230 reqs/sec.
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq-markets/pull/13

-- Commit Summary --

  * replace apcu caching with opcache and re-enable caching.  The trades API is about 35 times faster with opcache than apcu on local machine.

-- File Changes --

    M README.md (2)
    M lib/filecache.class.php (85)

-- Patch Links --

https://github.com/bisq-network/bisq-markets/pull/13.patch
https://github.com/bisq-network/bisq-markets/pull/13.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq-markets/pull/13
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20180709/d3b05684/attachment.html>


More information about the bisq-github mailing list