Project

General

Profile

Actions

Feature #20500

closed

Change the DB backend to use a default cache table

Added by Ingo Renner about 15 years ago. Updated about 11 years ago.

Status:
Rejected
Priority:
Should have
Category:
Caching
Target version:
-
Start date:
2009-05-25
Due date:
% Done:

0%

Estimated time:
PHP Version:
4.3
Tags:
Complexity:
Sprint Focus:

Description

currently you have to set up a separate table for each cache using the DB backend. To ease the use of the DB backend by default everything should go into a default table. A separate table can then still be defined for performance reasons f.e.

(issue imported from #M11181)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #27536: Caching framework db backend: Use own namespaceClosed2011-06-19

Actions
Actions #1

Updated by Ernesto Baschny over 13 years ago

I think this would still be a cool addition to get the caching framework more easy to use for extension developers in 4.5. Do you think you have some time to think about an easy solution?

Actions #2

Updated by Ernesto Baschny over 13 years ago

@Christian, do you have any opinion / idea on this?

Actions #3

Updated by Christian Kuhn over 13 years ago

I'm unsure if that would give us a real benefit.

Here is the current situation:
- We currently have 3 core caches: pages, pagesection, hash. All of them work with two separate tables, each. This is useful and shouldn't be changed: It gives you the advantage to configure them separately, for example it's often a benefit to enable data compression for pages, but not for the other tables.
- Extensions I am aware of, which use the caching framework:
-- tt_news: I'm unsure what exactly goes into it
-- exbase: It uses the cf for a reflection cache. I have no idea if this should be mixed with other data
-- enetcache: A cache to store content element data. This should not be mixed with other data, it usually has high read and low write load and tons of tags assigned to an entry.

My point:
Each cache has it's own usage signature and should be tuned for exactly this use case. Any developer can and should deliver an extension with a sane default for his case.

If I understand right, this issue is about adding two default tables (tag and data) to gather different caches in those tables if nothing else was configured. This actually can be done, and we could even remove the other tables for pages, pagesection and hash and route it's content to this table by default.
A real problem is that the db backend currently truncates the complete table on flush() (because this is way faster than deleting each entry in a loop). This must be changed then to only delete entries of the affected cache and will lead to a massive slowdown on cache clearing. Removing the truncate from dbbackend is no option, we will need an alternative handling for cache clearing if the table is a "multi cache" table, and add logic to handle it.
BTW: That's why memcache cache clearing is so slow: memcache has no namespacing, it must first find all affected entries and delete them in a loop. That's also why redis is lightning fast on cache clearing, every cache should go to an own database, each cache is flushed with one call.

Here are the things we should do if we want a default table:
- Hack the dbbackend to add logic for a cache clearing in "multi cache usage", accepting a massive slowdown on cache clearing (estimated slowdown: At minimum O(n) in contrast to O(1) for number of affected entries, probably even worse due to the tags table).
- Add default table routing in the manager (or factory?) to route unconfigured dbbackends to this table
- Think about removing pages, pagesection and hash default table configuration and route them to this table. If we don't do this, we might end up with just two additiional db tables which are never used by the core.

All in all I have the feeling that this is not worth it, the only benefit is a little more straight localconf, and some less tables in our default configuration.

Actions #4

Updated by Ernesto Baschny over 13 years ago

Christian, thanks for the opinion, I tend to share the same opinion. Let's see if Ingo has some other ideas or arguments about this one, else we simply close the issue again.

Actions #5

Updated by Ingo Renner over 13 years ago

Hey guys,

the default table is meant for extensions only and as a default when no other specific table has been configured. Concerning cache clearing, since we're free to do what we want with the DB backend, we could of course introduce a namespace here and use that when clearing the cache...

Actions #6

Updated by Christian Kuhn over 13 years ago

Hey Ingo.

I still think we don't need that:
Every cache by some extension is done for some purpose. An author probably does not want to share this with other caches in the same table which can lead to unpredictable performance impact. I don't see a reason to implement a shared table space which is delivered by core, unused by core, just for extensions, and extensions shouldn't use it for performance reasons. Do you see a problem with two dedicated tables for each cache?

At the moment I see no reason in refactoring the db backend in this regard, there is no advantage. Did I miss something?

Actions #7

Updated by Xavier Perseguers almost 13 years ago

  • Assignee changed from 29166 to Christian Kuhn
  • Target version changed from 4.6.0 to 4.6.0-beta1
Actions #8

Updated by Ernesto Baschny almost 13 years ago

I agree that we should close this issue. The "auto-creation" of cache tables on demand is a cool solution for the "problem" (extensions don't need to create them) and we still have the flexibility we need in our core to change the definitions later.

So +1 on closing it. Christian is on the same opinion still. Ingo, any further comments?

Actions #9

Updated by Stefan Neufeind almost 13 years ago

+1 to close this.

Actions #10

Updated by Christian Kuhn almost 13 years ago

  • Status changed from Needs Feedback to Rejected

Rejected. This will not be realized due to possible more elegant solutions with recent cache patches.

Actions #11

Updated by Ingo Renner almost 13 years ago

Next time you guys ask for my feedback, it'd be cool to actually wait for it, too ;)

... even if I agree with dropping the issue... :)

Actions #12

Updated by Ernesto Baschny about 11 years ago

  • Target version deleted (4.6.0-beta1)
Actions

Also available in: Atom PDF