Project

General

Profile

Actions

Feature #17544

closed

Round Robin for native MySQL SELECT queries

Added by Marcel Alburg over 16 years ago. Updated almost 9 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2007-08-20
Due date:
% Done:

0%

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

Description

I've create a Patch (just a proof-of-concept) to Cluster the Select Statements from Typo3.

You can enter in localconf.php multiple slave servers. This servers will be selected by rand(0, [amount of slave servers]). I add a "dead File" to disable a slave server (in case of emergency or planned downtime). This file must be remove by hand from admin.

It's possible to create this deadFile by hand (in case "out-of-sync" of the slave db servers).

In the backend, the normal master server will be used.

Proof-of-Concept

----
$TYPO3_CONF_VARS['SYS']['slave_db_handler'][] = array(
'typo3_db' => 'db',
'typo3_db_host' => 'slave01',
'typo3_db_password' => 'geheim',
'typo3_db_username' => 'user',
'dead_file' => 'typo3conf/slave01_db_dead'
);

$TYPO3_CONF_VARS['SYS']['slave_db_handler'][] = array(
'typo3_db' => 'db',
'typo3_db_host' => 'slave02',
'typo3_db_password' => 'geheim',
'typo3_db_username' => 'user',
'dead_file' => 'typo3conf/slave02_db_dead'
);
----
(issue imported from #M6180)


Files

round_robin_mysql_select.diff (2.58 KB) round_robin_mysql_select.diff Administrator Admin, 2007-08-20 22:29
Actions #1

Updated by Oliver Hader over 16 years ago

Hi Marcel,

I like the idea of load balancing, but there are some things missing in my point of view:
  • Maybe the balancer could be integrated to the system extension DBAL?
  • If I got it right, each query might create and use a different connection. IMO it would be better to use the same connection (which is already opened) for one HTTP request to the website.
  • Maybe there is a way, to find out the current load/opened connections on the remote database servers and use the remote system with the lowest load.

But since this is a proof-of-concept I doesn't have to be perfect on the first approach, but showing the possibilities/features. So, keep it up! :-)

Actions #2

Updated by Marcel Alburg over 16 years ago

Yes, i know. A patch for DBAL is my next project because i use PostgreSQL (and with PostgreSQL it's possible to balance the Select Statemants with an PGSQL Extension).

I add this just for discuss to know if it usefull to implement the Balancer Script in Typo3 Core.

Marcel

Actions #3

Updated by Martin Kutschker over 16 years ago

I don't think this should go into the Core. For Mysql I'd prefer a standalone extension like DBAL. For DBAL I'd like to see a seperate extnesion as well because DBAL is so bloated.

Actions #4

Updated by Marcel Alburg over 16 years ago

Hello

but the most of the typo3 users don't use DBAL. And if you use DBAL, you've a lower website generation speed.

In the next time, i'll write a patch for DBAL. But i think, it's important to discuss to accept this patch for the core.

Marcel

Actions #5

Updated by Martin Kutschker over 16 years ago

I have written that I want an extra extension, not a Core inclusion (neither in t3lib_db directly nor in DBAL).

Actions #6

Updated by Marcel Alburg over 16 years ago

Ahh ok :).

But that, we need a Hook in for the Core.

Actions #7

Updated by Klaus Hinum over 11 years ago

  • Target version deleted (0)

Any update on that issue, is there already a hook in the core. I see this one of the most important features for big T3 installations as it allows an easy way to cluster the DB.
It would be perfect to allow a write to many db and read to the specified. This way you could easily install more frontends.

Actions #8

Updated by Thomas Löffler about 10 years ago

Any news on that?

Actions #9

Updated by Morton Jonuschat almost 9 years ago

  • Description updated (diff)
  • Status changed from New to Rejected

After discussing this in #typo3-cms-coredev on Slack this is out of scope for the Core. It could be implemented by an extensions that extends the DatabaseConnection class the same way EXT:dbal does.

Actions

Also available in: Atom PDF