I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
The default formula use by AWS RDS to calculate the max_connections
parameter is: LEAST({DBInstanceClassMemory/9531392},5000)
But It's hard to find the exact value of DBInstanceClassMemory
.
So, here are the values I got when I ran the SQL commmand: show max_connections;
in some RDS instances:
Instance type | RAM (GB) | max_connections |
---|---|---|
db.t2.small | 2 | 198 |
db.t2.medium | 4 | 413 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Located under app/ | |
""" | |
import os | |
from django.apps import apps | |
from django.conf import settings | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") |