Welcome Guest, Not a member yet? Register   Sign In
Best way to perform application level high availability authentication
#3

If you're looking at doing this on the CI back-end, and that portion of the code is basically new code, I would recommend creating a sort of data abstraction layer (DAL) which simply maintains two database library configurations (mysqli and sqlite3, most likely) and writes all of the data to both, then reads from the first available. If one is unavailable during a write, you can cache the write(s) until it becomes available.

However, you probably won't be able to use auto-incremented keys in a setup like this (as they may become out of synch, especially if the connection to MySQL is unreliable). If you wanted to continue using simple integer keys (like most auto-incremented keys), you would probably have to create them in the DAL itself.

You will probably also have to make other concessions to what can be supported by both platforms at once, but this is much easier to do at the start of a project than as an afterthought.

Then you just use the DAL to perform all of your interaction with the database instead of calling $this->db directly, and you're in the clear. You may run into problems beyond those I've outlined above, but you only have to solve them in the DAL, not every model in your application, and you don't have to limit your users when MySQL isn't available.

Of course, if an existing DAL can be found which supports these features and can be adapted for use with CodeIgniter (or already works with CodeIgniter), that would be even better than rolling your own (and I'd certainly be interested in hearing about it, as I'd like to implement a DAL in Bonfire if I can get the right set of features).
Reply


Messages In This Thread
RE: Best way to perform application level high availability authentication - by mwhitney - 09-10-2015, 07:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB