Link to home
Start Free TrialLog in
Avatar of Gas
Gas

asked on

Django + postgresql at Azure VM

I would like to create a postgresql database on a django enviroment on a VM on Azure .

Since I would like to minimize the cost i would like to to know the minimum specs of the Vm for this application, ( what is the need of ram ,cpu and storage)

I would like to know   
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

Dear,
I7 or above CPU.
80 GB or above disk storeage.
8 GB or above Ram.

Other than Postgresql, you can also consider SQL server Express.


Avatar of Gas
Gas

ASKER

what do you mean by i7 ?

how many cores/vcpu is needed?
I am trying to make an estimation of the cost via azure calculator
https://azure.microsoft.com/en-us/pricing/calculator/


Avatar of Yujin Boby
It is difficult to tell the exact requirement as it depends on your application + traffic. You may need to test and see what work for your application

You can start with a  VM with 2 GB RAM 2 VCPU. It is easy to upgrade the server if you have higher requirement.

To minimize cost.

1) Use bare metal dedicated servers, rather than VMs.

2) Using a VM can cut throughput as must as 90%, by just installing code on a VM, as all instructions have to be "interpreted" rather than executed.

3) Use a cheap bare metal Linux machine, preferably using LXD as your container system + your cost will be much lower.

Because if a VM cuts throughput by 90%, then just to get bare metal speed, you'll require purchasing 10x unit of computational speed.

Also, with an SQL server, you'll now be fighting I/O congestion with all other users accessing raw disk space.

Worse, if disks are network attached, how you have the speed penalty of running over TCP, rather than Kernel memory speed of a locally attached disk.

4) So to "minimize cost"... for stellar performance, use a bare metal server.

Checkout pricing of OVH/SoYouStart/KimSufi - ranges from stratospheric prices (OVH) to $5/month (KimSufi).
For determining CPU requirements, go for highest thread count you can afford.

Determining memory requirements are more complex.

Here's how I do this.

1) Setup an LXD container running on a 64G or 128G machine.

2) Run the entire LAMP Stack for 30 days.

3) Every day retune database using the related tuning tool...

I only use MariaDB, so I use mysqltuner.

https://github.com/jfcoz/postgresqltuner appears to provide the same facility for PostgreSQL.

4) Normally over a 30ish day (sometimes more or less), site will have received traffic to represent common usage pattern.

5) Thus, after tuning over a 30 day period, your tuning parameters will have told you exactly how much memory is required.

Said differently, the only way to know optimal memory size for an SQL based codebase, is to run the SQL long enough, where no tuning is required.

No guessing. Just testing + knowing.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.