How to run multiple instances of Writer simultaneously?
Matthew J. Francis
mjay.francis at gmail.com
Thu Oct 19 13:31:38 UTC 2017
On 19/10/2017 17:09, Jens Tröger wrote:
> Thanks Matthew!
>
> That’s close to what I’m using. However, would you mind sharing your “close document” code, as well as shutting down the soffice process?
>
> In that context, it looks like you’re using the soffice process as the server? How about projects like listed in this question: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=75523 What about scalability as per this question: https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=74002
>
> Thank you,
> Jens
Well, in the context of the previously included code, cleanup was a
matter of:
os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
shutil.rmtree (tempDir)
which is I think not what you want - it was purely used to run a test,
then terminated with prejudice when the result was known.
Something like you mentioned earlier should be sufficient to make the
instance (one soffice.bin and wrapper script) go away cleanly in the
normal case:
document.close(True)
desktop.terminate()
Whether running a persistent server process instead would suit your
needs better is something you'll have to test with your actual use case.
Without knowing exactly what it is you're trying to achieve, I can only
speculate in general terms:
On the one hand, running everything through a persistent LO instance as
server will give you reasonably low latency if it's something time
sensitive, but it may struggle to make use of the ample threads of
modern processors if there are many parallel requests to service; on the
other hand, running everything on individual, isolated instances means
you will incur a relatively high fixed cost for each startup (even with
cached user profiles, it will still take some time to load a whole new
LO), but may ultimately scale to use CPU resources better if each
individual transaction is fairly long running and CPU intensive.
Regards
Matthew Francis
More information about the LibreOffice
mailing list