I've been searching without success a plugin that might split Joomla's read queries to one endpoint and write queries to another endpoint. This would enable us to use Amazon RDS's read replicas (MySQL).

Does anybody know how to achieve this, or if there is some plugin/extension available?

UPDATE: I tried to do my own driver based on what was suggested in one of the answers, I did not suceed to make it work. I created a gist so anybody can easily help me solve the issue: https://gist.github.com/siran/77d65f9375cf7b787c83/revisions


1 Answer 1


To play with MySQL configutation, the solution is beyond a system plugin. It has to catch every query and manage the applied configuration.

In my opinion, the best solution would be to create a new database driver (or modify one of the core drivers). For example, you can create a mysqliaws.php and modify the required files to add it into the core.

On the other hand, Amazon could have its own PHP driver to route queries to the right instance.

  • I agree Amazon should take care of routing the queries, but it doesn't. So I'll try your answer, good idea. Thanks.
    – arod
    Apr 12, 2015 at 1:37
  • I tried to emulate mysqli drivers, but it's cumbersome and I didn't make it :( ... do you know if someone has done something similar?
    – arod
    Apr 13, 2015 at 17:29
  • I created a gist with the modified driver: gist.github.com/siran/77d65f9375cf7b787c83/revisions
    – arod
    Apr 13, 2015 at 17:40
  • The idea is Ok. As a first proof of concept, I would just modify JDatabaseMySQLi to test the modifications scope. Once you get the final version, you can go for the extra step of Joomla "new driver" development. For example, you could just create JDatabaseMySQLiAws extending JDatabaseMySQLi (most methods are public/protected).
    – Anibal
    Apr 13, 2015 at 18:36
  • Yes I basically did that, the only difference being I created a new file and put this is configuration.com I get the error posted on the Gist, Duplicate entry 'h2rgkf6idru0r2lnpv5iqib3i1' for key 'PRIMARY' SQL=INSERT INTO jos_session (session_id, client_id, time) VALUES ('h2rgkf6idru0r2lnpv5iqib3i1', 0, '1428946167')
    – arod
    Apr 13, 2015 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.