itsquestiontime1
itsquestiontime1

Reputation: 45

Threading and Django db create operations

I have a python script which collects information for actors from various APIs (wikipedia, tmdb and imdb) then adds them to a postgresql database. It worked well but was sometimes a little slow due to all the API requests.

So I altered this script to use threading, however running it now produces the following error:

OperationalError: FATAL:  remaining connection slots are reserved for non-replication superuser connections

Am I hitting the database too much in a short space of time perhaps? Thanks in advance

Upvotes: 2

Views: 227

Answers (1)

raacer
raacer

Reputation: 5481

Allow more connetions in your postgresql.conf by increasing value of max_connections.

UPDATED:

You may also need to increase the SHMMAX value. Run this command from terminal:

sysctl -w kernel.shmmax=1073741824

This will set SHMMAX to 1G. Tune this according to your RAM size.

Upvotes: 1

Related Questions