-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Moved self database from session to request scope. #441
base: master
Are you sure you want to change the base?
Conversation
A new db connection is established on each http request and closed after the request has completed. This prevents "too many connections" exception from MySql to happen while too many users are logged in.
@criske thank you for your Pull Request. I'll assign someone to review it soon. |
@amihaiemil this could be improved further if we pass a no bounty needed for this PR :D |
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role Please, make sure there is at least one available contributor with the required role and the project can afford to pay them. |
@criske Nu e mai bine sa fie session scoped? Imi amintesc ca intentionat am facut-o session scoped, ma gandeam ca e mai bine sa-si tina user-u conexiunea cat timp lucreaza in self-web (durata sesiunii), ca sa nu tot isi ceara fiecare conexiuni noi la fiecare request :-? Oricum, cred ca e de ajuns sa pui RequestScoped pe SelfCoreComponent (si aia e Closeable si inchide fix instanta de DB). |
@amihaiemil la 150+ utilizatori logati in acelasi timp, mysql o sa crape, asta daca nu-i modifici
De asta am amintit de connection pools.
|
@criske jesus, numa' 150? Pai si daca sunt 150 de useri si e request scoped, si toti dau un refresh la pagina, nu tot acolo se ajunge? Nu credeam ca trebuie sa ne batem capu cu connection pooling si chestii de genu asa repede... |
@criske clar intru sa modific pe server numaru ala, nu-i ok deloc. O sa merge-uiesc si PR-ul asta putin mai incolo, acum vreau sa fac un release cu ce avem saptamana asta (apropo, release 0.0.6 e deja facut, poti schimba la |
@criske apropo, ScropeProxyMode.INTERFACES ce face mai exact? : D |
@amihaiemil Daca nu e setat pe |
@criske ok, mersi de explicatie :D |
@amihaiemil Scratch that, am reverificat si merge si fara |
@criske stii cumva care ar fi impactul asupra vitezei daca facem schimbarea asta? Local si in Test poate nu se va vedea nu-stiu-ce pentru ca DB-ul e pe aceeasi masina. Dar in Prod e o masina diferita si, in general, e acest trade-off: daca conexiunea e request-based, automat request-ul va dura mai mult :D |
@amihaiemil n-am testat, dar la momentul de fata, sa deschizi o connexiune la fiecare request e mult mai ineficient fata una per session.
Pentru connection pool cel mai ok ar fi https://github.com/brettwooldridge/HikariCP . Apropo, am gasit asta referitor la cum sa configurezi nr de
Also this: https://dba.stackexchange.com/questions/1229/how-do-you-calculate-mysql-max-connections-variable
|
@criske mersi de info. Asa m-as gandi si eu, momentan sa lasam session scoped si daca da Domnu la mai multi user, scalam dupa aia cumva. Stii vorba aia: "I like to think how I can scale my application 10x before I even scaled it 2x" :)) Is socat de cat de putine conexiuni se recomanda. Eu imi inchipuiam cel putin cateva mii asa, din oficiu... :D |
@zoeself remove |
@amihaiemil ok, I've removed this task from scope. I'm not managing it anymore. |
PR for #442
A new db connection is established on each http request and closed after the request has completed.
This prevents "too many connections" exception from MySql to happen while too many users are logged in.