Django multiprocessing and database connections

前端 未结 9 859
挽巷
挽巷 2020-11-28 03:16

Background:

I\'m working a project which uses Django with a Postgres database. We\'re also using mod_wsgi in case that matters, since some of my web searches have m

9条回答
  •  情话喂你
    2020-11-28 03:48

    You could give more resources to Postgre, in Debian/Ubuntu you can edit :

    nano /etc/postgresql/9.4/main/postgresql.conf
    

    by replacing 9.4 by your postgre version .

    Here are some useful lines that should be updated with example values to do so, names speak for themselves :

    max_connections=100
    shared_buffers = 3000MB
    temp_buffers = 800MB
    effective_io_concurrency = 300
    max_worker_processes = 80
    

    Be careful not to boost too much these parameters as it might lead to errors with Postgre trying to take more ressources than available. Examples above are running fine on a Debian 8GB Ram machine equiped with 4 cores.

提交回复
热议问题