Skip to content
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

replace apcu caching with opcache and re-enable caching. #13

Merged
merged 1 commit into from Jul 10, 2018

Conversation

peertrade
Copy link
Contributor

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.

…PI is about 35 times faster with opcache than apcu on local machine.
Copy link
Member

@ManfredKarrer ManfredKarrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@ManfredKarrer ManfredKarrer merged commit 5f9566c into bisq-network:master Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants