Closed (duplicate)
Project:
Drupal core
Version:
8.7.x-dev
Component:
cache system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Jun 2017 at 10:44 UTC
Updated:
17 Nov 2018 at 20:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
cburschkaComment #4
cburschkaComment #6
cburschkaThe cache backend is also used directly by the bootstrap container definition, so we need to update that as well.
(This is not problematic in core, as the phpserializer wrapper class doesn't depend on anything. But it does mean that any contrib alteration cannot affect the container cache, which is accessed by the bootstrap container.)
Comment #8
cburschkaUpdated the unit tests.
Comment #10
cburschkaAnd a final unit test.
Comment #11
znerol commentedThanks for the effort. Why do you think so?
Comment #12
dawehnerMy assumption would be that you can swap out the serialization implementation with one of the faster alternatives?
Comment #13
cburschkaPretty much, or add other functionality. For example, right now the easiest way for a contrib module to compress the cache data is to swap out the entire cache backend for a new service. With this patch, it would be enough to swap out the regular cache backend's serializer with one that transparently compresses.
I stumbled over this while comparing the storage services for key_value and cache_: The former uses the serialization service, while the latter uses the PHP functions directly, for which I can't see a clear reason.
Comment #14
dawehner@cburschka
Please document this in the issue summary, so its easier for others to understand.
Comment #15
znerol commentedEven though
Drupal\Component\Serialization\PhpSerializelooks quite innocent, we still might want to check the performance impact of this modification.Also: Why do we actually serialize here at all? It looks to me that the cache backend is responsible for serialization/deserialization in the first place.Update: Please ignore that comment, I was under the impression, that we are discussing
serialize/unserializein page cache. Sorry for that.Comment #17
borisson_Made a small update to the IS, I wanted to try to the patch but it no longer applies, so added the needs reroll tag.
I don't think we need any explicit test coverage for this, because it's indirectly tested sufficiently. I agree with @znerol though, this needs profiling tests to see if this makes usage slower.
The patch does look quite simple, so that's great.
Comment #18
jofitzRe-rolled.
Comment #20
jofitzFixed test failure.
Comment #21
borisson_I tested this by running
ab -n 200 -c 1to a local drupal install (home page, a view with 5 pages, only page cache)The first line is without the patch, the second with the patch. It looks like this is a decent improvement. We should probably do a check with xhprof as well but it looks like this patch does improve the request time.
Comment #22
dawehnerIt would be nice to see this on a real life website with a LOT of cache gets.
@borisson_ Page cache basically means you have just a few cache gets. It becomes more interesting if you would have way more cache gets on the page.
I tried to disable page cache and dynamic page cache and reproduced your test. Its hard to say but I think the result is still inside random fluctuation: https://blackfire.io/profiles/compare/a7abdb67-01b2-4f4e-8b9e-9a7f19ba30...
Maybe @berdir could make some profiling for their gigantic installations?
Comment #24
borisson_@dawehner, yes - having real-world profiling would be a lot better. However, both your tests and mine did find that there isn't a big change that we should worry about.
Comment #25
fabianx commentedI like the patch, but isn't that a pretty hard BC break for the Cache\DatabaseBackend Interface?
Comment #27
fabianx commentedDuplicate of #839444: Make serializer customizable for Cache\DatabaseBackend.