Skip to content
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

add postgres tuning config #945

Merged
merged 1 commit into from
Nov 13, 2024
Merged

add postgres tuning config #945

merged 1 commit into from
Nov 13, 2024

Conversation

DaMandal0rian
Copy link
Contributor

@DaMandal0rian DaMandal0rian commented Nov 13, 2024

PR Type

enhancement, configuration changes


Description

  • Added a custom postgresql.conf file with various tuning parameters for Postgres.
  • Updated the docker-compose.yml to mount the custom postgresql.conf and configure Postgres to use it.
  • The tuning includes settings for connections, memory, checkpoints, planner, parallel queries, WAL, autovacuum, logging, and locking.

Changes walkthrough 📝

Relevant files
Configuration changes
docker-compose.yml
Configure Postgres service to use custom configuration file

docker-compose.yml

  • Added a volume for postgresql.conf to the Postgres service.
  • Updated the Postgres service command to use the custom
    postgresql.conf.
  • +2/-0     
    Enhancement
    postgresql.conf
    Add custom Postgres tuning configuration file                       

    indexers/db/postgresql.conf

  • Added a new postgresql.conf file with tuning parameters.
  • Configured connection, memory, checkpoint, planner, parallel query,
    WAL, autovacuum, logging, and locking settings.
  • +52/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    netlify bot commented Nov 13, 2024

    Deploy Preview for dev-astral canceled.

    Name Link
    🔨 Latest commit bd568e6
    🔍 Latest deploy log https://app.netlify.com/sites/dev-astral/deploys/6734df31ea803b0008799783

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Configuration Mount
    Ensure the path for the postgresql.conf in the docker-compose file is correct and accessible.

    Performance Settings
    Review the memory and connection settings to ensure they are optimized for the expected workload and hardware.

    Logging Configuration
    Verify if extensive logging settings are suitable for production environment as they can impact performance.

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Performance
    Adjust shared_buffers to a safer proportion of system memory

    Review the shared_buffers setting to ensure it does not exceed 25% of the total
    system memory, especially on systems with other significant memory demands.

    indexers/db/postgresql.conf [17]

    -shared_buffers = 8GB
    +shared_buffers = 2GB
    Suggestion importance[1-10]: 6

    Why: The suggestion to adjust shared_buffers to a lower value is valid to prevent potential memory issues, especially on systems with limited memory or multiple applications running.

    6
    Optimize the max_connections setting for better resource management

    Consider adjusting the max_connections setting based on expected database load and
    available system resources to avoid potential resource exhaustion.

    indexers/db/postgresql.conf [12]

    -max_connections = 500
    +max_connections = 100
    Suggestion importance[1-10]: 5

    Why: Adjusting max_connections can help manage resources better, but the suggestion to reduce it to 100 may not be suitable without specific context about the expected load and available resources.

    5
    Increase wal_buffers for improved write performance

    Modify the wal_buffers setting to a higher value to potentially improve write
    performance, considering the increased max_wal_size.

    indexers/db/postgresql.conf [21]

    -wal_buffers = 64MB
    +wal_buffers = 128MB
    Suggestion importance[1-10]: 4

    Why: Increasing wal_buffers could improve write performance, but the impact might be minimal and depends on other database settings and the specific workload characteristics.

    4

    Copy link
    Collaborator

    @marc-aurele-besner marc-aurele-besner left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM

    @DaMandal0rian DaMandal0rian merged commit e6d133c into main Nov 13, 2024
    13 checks passed
    @DaMandal0rian DaMandal0rian deleted the hotfix/postgres branch November 13, 2024 17:31
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants