-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x][feature] Support for horizontal MySQL scaling #423
Comments
The thing is that the project is basically "just" a pure implementation of a login system. All features should only be directly related to the login topic. The scaling thing is totally out of scope in my opinion, even Laravel etc. don't have this. I also think that this is something only hardcore users would use, and do they really use THIS project (I'm still unsure what the target group is) ? Hmm... I would say: Good idea, and definitly important for larger projects, but let's keep the project as simple as possible. What do the others say ? |
I use this login-system in a larger project and one of the first things I implemented for me was to use more then one database for exactly the reason @TemaSM stated. |
I fully agree with @sopitz, cause this feature(in future) and this project saving a lot of time. I think will be good idea if you - @panique will create new repository with "php-login" files including extra features for big projects. And u really need to know, that most of who using your project - professionals =) |
Wow! :) Okay, let's discuss this a little bit! @sopitz Can you give a short info on how this would look like, just a short estimation, maybe pseudocode or something. I've never worked with more than one DB server/connection and cannot really give useful info on that. By the way: The 2.0 version is just out, so let's integrate this into 3.0 (maybe in early 2015) and work on a new branch. |
No problem. I'll do that later then, right? |
@sopitz Yeah, let's do this in July or August maybe, currently I'm busy with other stuff and setting up a roadmap for 3.0 will take some work. |
Okay, @panique. Now i'm not so needed in this feature (and maybe other people), but i can help u with implementing this feature. Feel free, to contact me. |
[edit by panique / dec 2014] [original post by @sopitz ]
To make it easier for me to get my staging-infos into the code I added a 'few' more constants. For the database I created a class like this:
You can register all your databases in there. That makes it easier to use in your code as well (reference a certain database by To manage all the different connections I created another class in the config area (which I also split up to user automated rollout-scripts that change configs, but thats probably another topic we could discuss).
I used a pattern for me to be able to run multiple instances on one server. Therefore I added an After you added this to your code you can simply call the Database-Constructor with a param (e. g. like this new Open issues for me:
One additional feature to that (combined with the staging and rollout) I implemented is the use of http:https://phinx.org/ to maintain my databases on the different environments. It can be easily configured and nicely used in rollout-scripts. |
Fantastic stuff! Out of curiosity: Can you give some demo informations about how your Environments-class looks like ? |
Uhh can't what for this upgrade, this opens up for SAAS 👍 |
@panique the Environments.php is another "enum".
but actually it works together with the Stages.php ("enum" as well).
This is useful in two ways. edit: thats how you would use it in your scripts then:
|
@panique is there a timeline when the branch for 3.0 will be created? Im thinking about extending my version a bit and would like to give that back to 3.0 then. |
Hey @sopitz , good question! To be honest, there's currently summer here in Europe, so I wanted to move the work on the 3.0 branch to autumn & winter, maybe in October 2014. Maybe it's a good idea to create the 3.0 develop branch right now :) I'll do this and comment again when done... |
haha @panique. Good point. I will get bored sometimes tho and take my machine to the lakes ;) thanks a lot! |
Okay @sopitz , I've just created a final 2.0(.1) tag for the 2.0 branch, so from now we simply use the develop branch for the 3.0 version :) Potential urgent fixes for 2.0 will be made in feature-branches of master branch. |
I found a huge issue with that approach after using it for a while. Seems like my script creates too many connections without reusing or closing old ones. So please DONT use the approach described above. |
He everybody, the new HUGE has now a DatabaseFactory class: Currently it's only used in a very simple way, like here in a model class: $database = DatabaseFactory::getFactory()->getConnection();
$sql = "....";
$query = $database->prepare($sql); |
Hi All, Anyone still toying with this idea? At least I can see use for a "simple", barebones structure for adding more than one DB, with Load Balancing. However, I, too, see the need for a clean framework that focuses on a -well- implemented, secure login system. In another GitHub-issue I read a proposqal (by TemaSM?, I'm not sure) to create an extra part, like a module maybe, that allows for expansion of functionality beyond the scope of PHP-Login. I think doing that would make PHP-Login the unifying Twitter Bootstrap-version of site backends. Worth a philosofical discussion, maybe. |
He everybody, the current DatabaseFactory allows exactly that (the Factory design pattern is basically able to "produce" new things, like in this case database connections to additional servers). I got this solution from http:https://stackoverflow.com/questions/130878/global-or-singleton-for-database-connection, maybe somebody could an implementation of connecting to multiple databases / servers. Btw personal experience: Maxing out the main (cloud-based) database server totally does the job for 99.99% of companies I would say. Currently DB servers from mainstream providers (Rackspace etc) can use 384 GB of RAM and 16-32 cores, that's insane and to be honest not even the biggest company i've ever seen from the inside doesn't even needed that. I think somebody who really needs this setup would use this quite tiny framework... Anyway, if somebody can add horizontal database scaling feature, then this would be awesome! |
Hey, I'm currently "cleaning" the project a little bit and moving feature-requests like this to an own list inside the readme file (find it under the "future features" point). I hope you are okay with it, as most tickets here are new features and not really bugs or so. My idea is just to avoid this project from getting oversized by too many features, so I'm closing the ticket, but for sure linking it from the readme in case somebody wants to implement this. I hope you are all okay with this. :) |
How about to use 2 or more MySQL connections for MySQL scaling?
I think it's must have feature. For example, if i want store Users in 1 DB, but Notes of these Users, i want store into 2 DB.
The text was updated successfully, but these errors were encountered: