pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0003-Increase-WSGI-process-count-to-5-on-64bit.patch

95ea96
From f9d883b97b24efaf82e510601a4711bc9c0ea9c7 Mon Sep 17 00:00:00 2001
2737e7
From: Christian Heimes <cheimes@redhat.com>
2737e7
Date: Thu, 14 Jun 2018 17:04:13 +0200
2737e7
Subject: [PATCH] Increase WSGI process count to 5 on 64bit
2737e7
2737e7
Increase the WSGI daemon worker process count from 2 processes to 5
2737e7
processes. This allows IPA RPC to handle more parallel requests. The
2737e7
additional processes increase memory consumption by approximante 250 MB
2737e7
in total.
2737e7
2737e7
Since memory is scarce on 32bit platforms, only 64bit platforms are
2737e7
bumped to 5 workers.
2737e7
2737e7
Fixes: https://pagure.io/freeipa/issue/7587
2737e7
Signed-off-by: Christian Heimes <cheimes@redhat.com>
2737e7
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2737e7
---
2737e7
 install/conf/ipa.conf               | 2 +-
2737e7
 ipaplatform/base/constants.py       | 5 +++++
2737e7
 ipaserver/install/httpinstance.py   | 1 +
2737e7
 ipaserver/install/server/upgrade.py | 3 ++-
2737e7
 4 files changed, 9 insertions(+), 2 deletions(-)
2737e7
2737e7
diff --git a/install/conf/ipa.conf b/install/conf/ipa.conf
95ea96
index 696e5aab1aca1875eb711b91351f41987a8379d1..912a63c2240e0681dfbeeac223a902b15b304716 100644
2737e7
--- a/install/conf/ipa.conf
2737e7
+++ b/install/conf/ipa.conf
95ea96
@@ -47,7 +47,7 @@ WSGISocketPrefix /run/httpd/wsgi
2737e7
 
2737e7
 
2737e7
 # Configure mod_wsgi handler for /ipa
2737e7
-WSGIDaemonProcess ipa processes=2 threads=1 maximum-requests=500 \
2737e7
+WSGIDaemonProcess ipa processes=$WSGI_PROCESSES threads=1 maximum-requests=500 \
95ea96
   user=ipaapi group=ipaapi display-name=%{GROUP} socket-timeout=2147483647 \
95ea96
   lang=C.UTF-8 locale=C.UTF-8
2737e7
 WSGIImportScript /usr/share/ipa/wsgi.py process-group=ipa application-group=ipa
2737e7
diff --git a/ipaplatform/base/constants.py b/ipaplatform/base/constants.py
95ea96
index ca4a12ec017e81b32dc796062608a96ce65a0235..075a3ba774e1286e50258b464bd7687d484f6029 100644
2737e7
--- a/ipaplatform/base/constants.py
2737e7
+++ b/ipaplatform/base/constants.py
2737e7
@@ -5,9 +5,11 @@
2737e7
 '''
2737e7
 This base platform module exports platform dependant constants.
2737e7
 '''
2737e7
+import sys
2737e7
 
2737e7
 
2737e7
 class BaseConstantsNamespace(object):
2737e7
+    IS_64BITS = sys.maxsize > 2 ** 32
2737e7
     DS_USER = 'dirsrv'
2737e7
     DS_GROUP = 'dirsrv'
2737e7
     HTTPD_USER = "apache"
95ea96
@@ -42,6 +44,9 @@ class BaseConstantsNamespace(object):
95ea96
     # WSGI module override, only used on Fedora
95ea96
     MOD_WSGI_PYTHON2 = None
95ea96
     MOD_WSGI_PYTHON3 = None
2737e7
+    # WSGIDaemonProcess process count. On 64bit platforms, each process
2737e7
+    # consumes about 110 MB RSS, from which are about 35 MB shared.
2737e7
+    WSGI_PROCESSES = 5 if IS_64BITS else 2
95ea96
 
95ea96
 
95ea96
 constants = BaseConstantsNamespace()
2737e7
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
95ea96
index 231bffa2c6ec1fd124738649912e4bd958e802b7..3764870ee77f2ba0da18ec004664e6f66c13bba1 100644
2737e7
--- a/ipaserver/install/httpinstance.py
2737e7
+++ b/ipaserver/install/httpinstance.py
95ea96
@@ -148,6 +148,7 @@ class HTTPInstance(service.Service):
2737e7
             DOMAIN=self.domain,
2737e7
             AUTOREDIR='' if auto_redirect else '#',
2737e7
             CRL_PUBLISH_PATH=paths.PKI_CA_PUBLISH_DIR,
2737e7
+            WSGI_PROCESSES=constants.WSGI_PROCESSES,
2737e7
         )
2737e7
         self.ca_file = ca_file
2737e7
         if ca_is_configured is not None:
2737e7
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
95ea96
index ab09b98406df251f769c4747c9250075ab610362..ee3cedd78a2f45f33665bf562e9426cf68325544 100644
2737e7
--- a/ipaserver/install/server/upgrade.py
2737e7
+++ b/ipaserver/install/server/upgrade.py
95ea96
@@ -1681,7 +1681,8 @@ def upgrade_configuration():
2737e7
         AUTOREDIR='' if auto_redirect else '#',
2737e7
         CRL_PUBLISH_PATH=paths.PKI_CA_PUBLISH_DIR,
2737e7
         DOGTAG_PORT=8009,
2737e7
-        CLONE='#'
2737e7
+        CLONE='#',
2737e7
+        WSGI_PROCESSES=constants.WSGI_PROCESSES,
2737e7
     )
2737e7
 
2737e7
     subject_base = find_subject_base()
2737e7
-- 
95ea96
2.14.4
2737e7