-
Notifications
You must be signed in to change notification settings - Fork 113
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
falling back to internal cache #55
base: develop
Are you sure you want to change the base?
Conversation
This is following the discussion in PR #54 |
Hi @tollmanz - any estimation as of when do you expect to review this PR ? I think it is pretty straight forward. |
Hi @shmuel-krakower! Thanks again for the PR. I am reviewing this now and I am afraid I do not understand the issue. I've read over the initial issue and have looked at the suggested code change and do not understand what the problem is. It seems that the logic was only slightly changed. The unit tests pass all the same and the tests test each of the possible outcomes of the method. I am not sure what is different. Can you try to articulate the problem again? If needed, feel free to show a code example that helps demonstrate the issue. |
Hi @tollmanz thanks for looking into it. $key = 'dummy';
$value = '100';
wp_cache_add( $key, $value);
$dummy_value = wp_cache_get( $key );
echo "Value is " . $dummy_value . "."; While you may think that this is ok that add fails while memcached is down, it is actually not ok, as WP doesn't try to failover by itself but expects the drop-in plugin to failover to internal memory caching. Without that behavior - having this plugin while memcached nodes are all down - results with no caching at all (including the default in-memory caching which is used everywhere in WP), which in turn show worse performance than WP original performance. One important thing is that I just figured that I should implement the same for the |
Ok...I think I follow now. In the I'm on board with this; however, the change need is much more involved than the code here. I see that the following methods would be affected by this issue:
Basically, the code always verifies that the object was set to memcached before adding it to the internal cache so that during the current execution, the internal cache and external cache are in sync. One approach would be to rethink this. I really like the idea that the internal and external caches are in sync and do not really like the idea of removing that code. Perhaps we could do something else, like detect if memcached is healthy before loading this module, allowing us to fallback to the internal implementation if it is not. Unfortunately, some of this finagling may cause some issues with how this cache interacts with core. |
Yes @tollmanz, you got it right and definitely this PR should include the modified behavior for all these mentioned methods, in case you accept it. The main problem I have with the current implemntation is that once memcached is not available, we lose caching completely, including the internal/in-memory/per-request/default one. This is causing WP to respond very slowly because it is built in a way that it depends on having at least the default caching. If you look at the wp source code (which I know you did) you see lots of core functions in which stuff is pulled from db and pushed into wp_cache_add/set... and later in the process it is getting the objects from the cache again. The current behavior makes the caches invalid completely in such a scenario and results with really bad behavior (which is worse than the default behavior where this plugin is not installed at all, because the default is in-memory which is always available). I'll update the PR to include all the relevant code changes to the list of methods you mentioned before and you can decide if you wish to merge it or not. I agree that this may result with inconsistency between the interal cache and memcached but it should happen only during periods where memcached is unavailble anyway. |
…ched is failing. Tests will run on Travis
Hi @tollmanz - I've just updated this PR with your suggestion to cover all methods to work with the internal cache even in case of memcached failure. Please note I didn't change get and getMulti - as their behavior is already aligned to query the internal cache first anyway. If you trust your tests - can you merge it? |
Just an update - my tests - both functional and performance have approved this this change to work as expected. |
Hi @shmuel-krakower! Just wanted to acknowledge that I saw your message. Really buried right now and trying to get to this soon. |
@tollmanz - thanks for the note, I'll wait. |
@tollmanz hi - quite some time since your last sign of life. btw - as the developer of this caching plugin you should be aware of this core WP bug: |
@shmuel-krakower I think this pull request will need tests that run the entire suite with memcached disabled — to verify the object does behave as expected when memcached has gone away. |
hmm that's good idea but I'm unsure how to do that. The only question I have is how can I share this test results? |
I assure you I am alive, just focused on other things at the moment. Potentially eying December as a time to work more on this plugin.
Great suggestion.
You can configure Travis to run with different environmental settings. For instance, you could set up an environment where memcached is not running. Unfortunately, it is hard to work out Travis CI integration locally. What I'd recommend doing is make a new branch off of this branch, change settings for the .travis.yml file, commit, push and PR, which will kick off a new build. Keep doing this until you get it right. It's clunky, but that's really the only way to do it. |
Hi @tollmanz could you give me a hint what's missing from my new PR - the travis tests cry on something missing at: #75
|
@shmuel-krakower This sucks. Looks like there is a new dependency in the WP unit testing framework that is not satisfied here. WP recently incorporated the REST API and this part of the unit test framework relies on it. I think we'll need to adjust the test set up altogether 😢 |
Could we use/lock to an older test version which doesn't use the REST API? |
#76 should have fixed the problem, but there's a deeper problem: the test suite is dependent on changes to the WordPress test suite that are only present in trunk. So it's not really possible now to run trunk tests against an older version of WordPress. |
@tollmanz please let me know what can I do the make this PR into the code base. Maybe I could take something which will ease your effort? |
No description provided.