[Libreoffice-commits] online.git: 2 commits - bundled/include wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 30 02:04:59 UTC 2017
bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 31 ++++++++++++++++
wsd/LOOLWSD.cpp | 36 +++++++++++++------
wsd/LOOLWSD.hpp | 1
3 files changed, 58 insertions(+), 10 deletions(-)
New commits:
commit 2c77fe54d4f3a770564d9e2e2e1e92e8fd7e5263
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Fri Jan 27 23:52:58 2017 -0500
wsd: update LibreOffice Kit header
Change-Id: I792bcd6aa28de0d0916e3676b76ea87994cd685f
Reviewed-on: https://gerrit.libreoffice.org/33668
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index d2ccc0f..8a59b4c 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -69,6 +69,11 @@ typedef enum
* LOK_CALLBACK_INVALIDATE_TILES payload.
*/
LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK = (1ULL << 2),
+
+ /**
+ * Turn off tile rendering for annotations
+ */
+ LOK_FEATURE_NO_TILED_ANNOTATIONS = (1ULL << 3)
}
LibreOfficeKitOptionalFeatures;
@@ -462,6 +467,32 @@ typedef enum
* - 'action' is 'Modify'.
*/
LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED = 31,
+
+ /**
+ * There is some change in comments in the document
+ *
+ * The payload example:
+ * {
+ * "comment": {
+ * "action": "Add",
+ * "id": "11",
+ * "parent": "4",
+ * "author": "Unknown Author",
+ * "text": "",
+ * "dateTime": "2016-08-18T13:13:00",
+ * "anchorPos": "4529, 3906",
+ * "textRange": "1418, 3906, 3111, 919"
+ * }
+ * }
+ *
+ * The format is the same as an entry of
+ * lok::Document::getCommandValues('.uno:ViewAnnotations'), extra
+ * fields:
+ *
+ * - 'action' can be 'Add', 'Remove' or 'Modify' depending on whether
+ * comment has been added, removed or modified.
+ */
+ LOK_CALLBACK_COMMENT = 32
}
LibreOfficeKitCallbackType;
commit e342c87dbf7b5ea2611b950a88f1f98f39ce5353
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Jan 28 17:25:14 2017 -0500
wsd: account for transient file connections
The connection limit MAX_CONNECTIONS
is for document WS connections, which
doesn't take into account the other
resources (.js, .css, etc.) that clients
request. These transient files are as
many as 10 per client. While they
are being requested, other clients
should not be blocked due to reaching
the limit.
We now take into account these connections
and allow at least half as many clients
as the limit to connect simultaneously
without blockage.
Change-Id: I42fd27b992457bcf765a7a85382e6d7caad4bc97
Reviewed-on: https://gerrit.libreoffice.org/33669
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 72dc826..8964c80 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1862,9 +1862,14 @@ void LOOLWSD::initialize(Application& self)
ChildRoot = getPathFromConfig("child_root_path");
ServerName = config().getString("server_name");
FileServerRoot = getPathFromConfig("file_server_root_path");
- NumPreSpawnedChildren = getConfigValue<unsigned int>(conf, "num_prespawn_children", 1);
+ NumPreSpawnedChildren = getConfigValue<int>(conf, "num_prespawn_children", 1);
+ if (NumPreSpawnedChildren < 1)
+ {
+ LOG_WRN("Invalid num_prespawn_children in config (" << NumPreSpawnedChildren << "). Resetting to 1.");
+ NumPreSpawnedChildren = 1;
+ }
- const auto maxConcurrency = getConfigValue<unsigned int>(conf, "per_document.max_concurrency", 4);
+ const auto maxConcurrency = getConfigValue<int>(conf, "per_document.max_concurrency", 4);
if (maxConcurrency > 0)
{
setenv("MAX_CONCURRENCY", std::to_string(maxConcurrency).c_str(), 1);
@@ -2285,20 +2290,32 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
throw IncompatibleOptionsException("port");
// Configure the Server.
- // Note: TCPServer internally uses a ThreadPool to
- // dispatch connections (the default if not given).
- // The capacity of the ThreadPool is increased here to
- // match MAX_CONNECTIONS. The pool must have sufficient available
- // threads to dispatch new connections, otherwise will deadlock.
+ // Note: TCPServer internally uses a ThreadPool to dispatch connections
+ // (the default if not given). The capacity of the ThreadPool is increased
+ // here in proportion to MAX_CONNECTIONS. Each client requests ~10
+ // resources (.js, .css, etc) beyond the main one, which are transient.
+ // The pool must have sufficient available threads to dispatch a new
+ // connection, otherwise will deadlock. So we need to have sufficient
+ // threads to serve new clients while those transients are served.
+ // We provision up to half the limit to connect simultaneously
+ // without loss of performance. This cap is to avoid flooding the server.
static_assert(MAX_CONNECTIONS >= 3, "MAX_CONNECTIONS must be at least 3");
- const auto maxThreadCount = MAX_CONNECTIONS + 1; // Spare for admin.
+ const auto maxThreadCount = MAX_CONNECTIONS * 5;
auto params1 = new HTTPServerParams();
params1->setMaxThreads(maxThreadCount);
auto params2 = new HTTPServerParams();
params2->setMaxThreads(maxThreadCount);
- ThreadPool threadPool(NumPreSpawnedChildren * 6, maxThreadCount * 2);
+ // Twice as many min and max since we share this pool
+ // between both internal and external connections.
+ const auto minThreadCount = std::max<int>(NumPreSpawnedChildren * 3, 3);
+ const auto idleTimeSeconds = 90;
+ const auto stackSizeBytes = 256 * 1024;
+ ThreadPool threadPool(minThreadCount * 2,
+ maxThreadCount * 2,
+ idleTimeSeconds,
+ stackSizeBytes);
// Start internal server for child processes.
SocketAddress addr2("127.0.0.1", MasterPortNumber);
@@ -2340,7 +2357,6 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
LOG_INF("Starting master server listening on " << ClientPortNumber);
srv.start();
-
#if ENABLE_DEBUG
time_t startTimeSpan = time(nullptr);
#endif
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index fa18f25..fa6ec5f 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -103,6 +103,7 @@ private:
{
}
+ void operator()(int& value) { value = _config.getInt(_name); }
void operator()(unsigned int& value) { value = _config.getUInt(_name); }
void operator()(bool& value) { value = _config.getBool(_name); }
void operator()(std::string& value) { value = _config.getString(_name); }
More information about the Libreoffice-commits
mailing list