Skip to content

Add least_conn option to be used in php upstream #104

@heyyo-droid

Description

@heyyo-droid

In Kubernetes environment, we use service to load balance nginx traffic accross several php-fpm traffic.
Today this load balancing is using default Round Robin algorithm.
Nginx proposes another alogirthm which checks which php-fpm use the least number of connections.
I never tried but I supposed it could help to distribute the traffic more equally according the current resources usage of php-fpm pods.

I know it's possible to create a new preset, that could define it'sown upstream config file, but I would to avoid this path, to keep the actual really configuration of drupal 11.

According what I understood we just need to add this param least_conn in the upstream block

upstream php_backend {
    # Add the least_conn directive here
    least_conn;
    
    # Use the Kubernetes Service Name (e.g., 'php-fpm-service')
    # Nginx will resolve this to the pod IPs in the Service
    server php-fpm-service:9000;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions