[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLWSD.cpp loolwsd/loolwsd.xml.in loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jun 20 11:11:48 UTC 2016


 loolwsd/LOOLWSD.cpp      |    7 +++++++
 loolwsd/loolwsd.xml.in   |    5 +++++
 loolwsd/test/Makefile.am |    2 ++
 3 files changed, 14 insertions(+)

New commits:
commit e4de35737c6f6396a92ab02f599a4777e9547c55
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Jun 15 18:46:13 2016 -0400

    loolwsd: max_concurrency setting added
    
    Change-Id: Iae3789d26ed2e1aba3806a6f99511fa6c7097988
    (cherry picked from commit f7587443721c66b0cbf2243ae00d799bfa8c6891)
    Reviewed-on: https://gerrit.libreoffice.org/26509
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 192c332..1e27187 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -22,6 +22,7 @@
 #include <sys/wait.h>
 
 #include <time.h>
+#include <stdlib.h>
 
 #include <cassert>
 #include <condition_variable>
@@ -1256,6 +1257,12 @@ void LOOLWSD::initialize(Application& self)
         NumPreSpawnedChildren = config().getUInt("num_prespawn_children", 1);
     }
 
+    const auto maxConcurrency = config().getInt("per_document.max_concurrency");
+    if (maxConcurrency > 0)
+    {
+        setenv("MAX_CONCURRENCY", std::to_string(maxConcurrency).c_str(), 1);
+    }
+
     StorageBase::initialize();
 
     ServerApplication::initialize(self);
diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in
index cb524a8..96c80dc 100644
--- a/loolwsd/loolwsd.xml.in
+++ b/loolwsd/loolwsd.xml.in
@@ -1,5 +1,7 @@
 <config>
 
+    <!-- Note: 'default' attributes are used to document a setting's default value as well as to use as fallback. -->
+
     <tile_cache_path desc="Path to a directory where to keep the tile cache." type="path" relative="false" default="@LOOLWSD_CACHEDIR@"></tile_cache_path>
     <sys_template_path desc="Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes." type="path" relative="true" default="systemplate"></sys_template_path>
     <lo_template_path desc="Path to a LibreOffice installation tree to be copied (linked) into the jails for child processes. Should be on the same file system as systemplate." type="path" relative="false" default="/opt/collaboraoffice5.0"></lo_template_path>
@@ -10,6 +12,9 @@
     <file_server_root_path desc="Path to the directory that should be considered root for the file server. This should be the directory containing loleaflet." type="path" relative="true" default="../loleaflet/../"></file_server_root_path>
 
     <num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
+    <per_document desc="Document-specific settings, including LO Core settings.">
+        <max_concurrency desc="The maximum number of threads to use while processing a document." type="uint" default="4">4</max_concurrency>
+    </per_document>
 
     <loleaflet_html desc="Allows UI customization by replacing the single endpoint of loleaflet.html" type="string" default="loleaflet.html">loleaflet.html</loleaflet_html>
 
diff --git a/loolwsd/test/Makefile.am b/loolwsd/test/Makefile.am
index c36cc2a..24c350c 100644
--- a/loolwsd/test/Makefile.am
+++ b/loolwsd/test/Makefile.am
@@ -1,3 +1,5 @@
+# Cap threads pools to 4.
+export MAX_CONCURRENCY=4
 AUTOMAKE_OPTION = serial-tests
 
 check_PROGRAMS = test


More information about the Libreoffice-commits mailing list