Commit graph

27 commits

Author SHA1 Message Date
Ashod Nakashian
9234dc4dc2 wsd: drop duplicate setpart before sending to clients
When switching parts (either by the keyboard or mouse)
LoKit sends a notification of the current part and
invalidates tiles. As a reaction to that the client
cancels its tiles and requests new tiles for the
new part.

Since the response to setpart is a large number
of tile cancellation and new requests, the
cost of setpart is significant (esp. with large
number of clients). To avoid that, we de-duplicate
setpart entries from the client queues so there
would be only at most one setpart (the last)
queued to be sent to the client. This minimizes
the unnecessary noise when the part changes
faster than the server and/or network can
keep up.

Change-Id: I87578004203acc63d43e6d398ca04e37f766d9ba
Reviewed-on: https://gerrit.libreoffice.org/36597
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:04:22 +02:00
Michael Meeks
381bed9388 Remove redundant structure, include, and _stop members. 2017-04-05 18:06:58 +01:00
Michael Meeks
2d1764d30e Dump ClientSession and MessageQueue state too. 2017-04-05 17:59:29 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Michael Meeks
6d6dc45850 Remove un-necesssary and inefficient wakeupWorld.
While message emplacement happens in the DocumentBroker poll, we
can be sure that the next iteration of the poll will call
hasQueuedWrites before polling.
2017-03-15 12:07:34 +00:00
Michael Meeks
44ec90343e SenderQueue - remove condition, and waiting. 2017-03-15 10:20:43 +00:00
Michael Meeks
33d1fa7cc0 Kill SenderThreadPool. 2017-03-10 10:47:44 +01:00
Michael Meeks
52327d78e2 Cleanout old socket code, and several obsolete LOOLWebSocket uses. 2017-03-10 10:47:43 +01:00
Michael Meeks
d4cc2e899c ClientSession: kill the writing thread. 2017-03-10 10:47:42 +01:00
Ashod Nakashian
f1de0d0481 wsd: MessagePayload -> Message
Change-Id: Ie65f7c707785dbbf85a2f98abf082fbc3ee7a64b
Reviewed-on: https://gerrit.libreoffice.org/33428
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:47:03 +00:00
Ashod Nakashian
6b17f96318 wsd: refactor MessagePayload into own file
Change-Id: Ifc0d2abd2e94d4a1b58915664fb0545dca6e96cc
Reviewed-on: https://gerrit.libreoffice.org/33427
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:45:23 +00:00
Ashod Nakashian
16eb196820 wsd: each Message object now has a unique ID for logging purposes
Change-Id: I5f3c3afec57f3d9336e0994a1d87421281028d79
Reviewed-on: https://gerrit.libreoffice.org/33426
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:42:34 +00:00
Ashod Nakashian
df32077005 wsd: read message payload from correct source
Change-Id: I9333b4ecb3aae7c22e93f0b92a3e6eed59bb875f
Reviewed-on: https://gerrit.libreoffice.org/32600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:53:31 +00:00
Ashod Nakashian
200bf6f92b wsd: fix compiler warnings of shadowing variables
Change-Id: I3a1344d58b1af11c95accb5f7a9d1c8e5b2d19fb
Reviewed-on: https://gerrit.libreoffice.org/32180
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/32181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 13:18:53 +00:00
Ashod Nakashian
2b9e695a3b wsd: deduplicate more messages
Change-Id: I0ad9ef7bf826b3fd0eba9cc17ec5212a3334a2f5
Reviewed-on: https://gerrit.libreoffice.org/32163
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 06:02:19 +00:00
Ashod Nakashian
839d7a9b43 wsd: deduplicate invalidate view cursor messages
Change-Id: I898c98ad42fb807ebeafafa47d85930025def57f
Reviewed-on: https://gerrit.libreoffice.org/32162
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 06:01:46 +00:00
Ashod Nakashian
49af971efb wsd: simplify tile deduplication
Change-Id: I34d83acc81b8169d8ae07ed53219b11fe0f0fec2
Reviewed-on: https://gerrit.libreoffice.org/32161
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:59:22 +00:00
Ashod Nakashian
df79138bc3 wsd: use Message members where possible
Change-Id: I7bcaa1306600b3e15bef7e7aff02a8a6cd64abf9
Reviewed-on: https://gerrit.libreoffice.org/32160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:58:04 +00:00
Ashod Nakashian
ea2c3eb15c wsd: deduplicate tile messages in SenderQueue
Change-Id: Ib1cc38f34534aa754503ef296871815bc3d5450d
Reviewed-on: https://gerrit.libreoffice.org/32158
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:55:33 +00:00
Ashod Nakashian
7e1529af31 loolwsd: add tokenization to MessagePayload
Change-Id: I39135b2ad65da5abce93848a68faffc93906a0c0
Reviewed-on: https://gerrit.libreoffice.org/32157
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:51:49 +00:00
Ashod Nakashian
58d679240c loolwsd: better MessagePayload encapsulation and cleanup
Change-Id: I690f1044f75582b6e7f05b2026f96a0720be2cbc
Reviewed-on: https://gerrit.libreoffice.org/32156
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:50:30 +00:00
Ashod Nakashian
fe38e0e1e6 loolwsd: per-socket dedicated sending thread
To avoid degrading performance for everyone
because of a single slow/bad connection, we
send data to clients each in its own thread.

Change-Id: I6f980c25a404c4d05bcdb1979849ea3d2776c7b9
Reviewed-on: https://gerrit.libreoffice.org/31984
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-14 04:21:20 +00:00
Ashod Nakashian
e60bc28a00 loolwsd: LOOLSession -> Session
Change-Id: I94369480fb0a6789375dfe5610ada300e94b80eb
Reviewed-on: https://gerrit.libreoffice.org/31930
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:34:19 +00:00
Andras Timar
e9a370176b wsd: fix error: declaration of ‘size’ shadows a member of 'this' [-Werror=shadow] 2016-12-12 12:08:51 +01:00
Ashod Nakashian
da97e2ac18 loolwsd: grow the SenderThreadPool dynamically
The pool is checked for expansion before processing
items from the queue. By tracking the number of idle
thread (i.e. not currently sending data) we ensure
that there is at least one idle thread before
we invoke the socket.

If there is not enough idle threads at that point,
a new thread is spawned, so long as we're below the
limit. This guarantees that even if all the active
threads block on the socket, we'd always have one
more to process new data (until we reach the limit,
which is as many client connections as we have).

Technically, a single slow connection could
still monopolize all connections if there are
many messages to be sent to it. For that we'd
need to track and assign one thread per connection,
something we don't currently do.

Change-Id: Ic8b5e064da068b37bcfa773005495b198763c31d
Reviewed-on: https://gerrit.libreoffice.org/31886
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:11 +00:00
Ashod Nakashian
f8d3576556 loolwsd: Sender Thread Pool
Change-Id: I36a0ad376dad1e6b0733ebfa930baf1dd5752a8c
Reviewed-on: https://gerrit.libreoffice.org/31885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:22:31 +00:00
Ashod Nakashian
0b42af6d8d loolwsd: move SenderQueue to wsd
Change-Id: I33af4d1b2bbf0305cbc5fa6f05266d126f1bb803
Reviewed-on: https://gerrit.libreoffice.org/31884
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:20:43 +00:00
Renamed from common/SenderQueue.hpp (Browse further)