How to run multiple instances of Writer simultaneously?

classic Classic list List threaded Threaded
27 messages Options
Next » 12
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

How to run multiple instances of Writer simultaneously?

Hello,

This email question is a repeat of one that I posted in the forums, but can’t seem to get attention:

    https://forum.openoffice.org/en/forum/viewtopic.php?f=25&t=90716

It seems to me that spawning multiple Writer instances as individual processes (using Python’s subprocess) and then shutting one process down kills the other as well. What vital resources are being shared here, and what is the recommended way of spawning multiple Writers (i.e. opening multiple documents) simultaneously? There’s more information in the forum’s post.

Thanks!
Jens

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Tor Lillqvist-2 Tor Lillqvist-2
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

You are using confusing terminology. "Spawn" is usually used in a software context to mean starting a new process running another program, what is on POSIX systems done using the fork() and exec() family of system calls, and on Windows using CreateProcess(). On the other hand, "Writer" is not a program by itself but (as you say) just one kind of document window that the real LibreOffice process (soffice.bin) displays, and a single soffice.bin process can have any number of Writer, Calc, Impress etc document windows open simultaneously.

I.e., are you asking how to spawn multiple soffice.bin processes, or how to open multiple Writer documents, at the same time?

For the first case, you need to spawn the processes with separate "user installation" directories. For the second case, that should be what normally happens.

--tml


_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
David Tardon David Tardon
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Jens Tröger
Hi,

On Thu, Oct 19, 2017 at 08:01:05AM +1000, Jens Tröger wrote:
> Hello,
>
> This email question is a repeat of one that I posted in the forums, but can’t seem to get attention:
>
>     https://forum.openoffice.org/en/forum/viewtopic.php?f=25&t=90716
>
> It seems to me that spawning multiple Writer instances as individual processes (using Python’s subprocess) and then shutting one process down kills the other as well. What vital resources are being shared here, and what is the recommended way of spawning multiple Writers (i.e. opening multiple documents) simultaneously? There’s more information in the forum’s post.

The pipe name must be different for each separate instance. And you
should really use a different UserInstallation for each instance as well.

D.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Tor Lillqvist-2
Thank you Tor for the clarification.

What I want to achieve is to use the Python UNO bridge to access multiple Writer documents at the same time.

If that can be achieved by running a single LO process (soffice.bin) then that works for me:
  - How does that approach scale when I open many Writers? (See this post re performance and scaling: https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=74002 )
  - Should I keep the LO process alive over long periods of time and then open/close Writer documents as needed? (See this post re the Office Server mode: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=75523 )

If I need to spawn processes with separate “user installation” directories, are you talking about the -env:UserInstallation command line argument?

Thank you!
Jens


> On Oct 19, 2017, at 16:31, Tor Lillqvist <[hidden email]> wrote:
>
> You are using confusing terminology. "Spawn" is usually used in a software context to mean starting a new process running another program, what is on POSIX systems done using the fork() and exec() family of system calls, and on Windows using CreateProcess(). On the other hand, "Writer" is not a program by itself but (as you say) just one kind of document window that the real LibreOffice process (soffice.bin) displays, and a single soffice.bin process can have any number of Writer, Calc, Impress etc document windows open simultaneously.
>
> I.e., are you asking how to spawn multiple soffice.bin processes, or how to open multiple Writer documents, at the same time?
>
> For the first case, you need to spawn the processes with separate "user installation" directories. For the second case, that should be what normally happens.
>
> --tml
>

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by David Tardon
Thank you David!

Yes, I generate different pipe names for each soffice instance; however, for performance reasons I did _not_ use different -env:UserInstallation for each (anymore). Perhaps that caused the problems.

The reason why I disabled the user installations was that the start-up of the LO process was noticeably impacted by using this option; in fact, opening a document could take up to a minute longer!

Cheers,
Jens


> On Oct 19, 2017, at 16:36, David Tardon <[hidden email]> wrote:
> Hi,
>
> The pipe name must be different for each separate instance. And you
> should really use a different UserInstallation for each instance as well.
>
> D.

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Kaganski Mike Kaganski Mike
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Jens Tröger
Hi,

On 10/19/2017 1:01 AM, Jens Tröger wrote:
> It seems to me that spawning multiple Writer instances as individual processes (using Python’s subprocess) and then shutting one process down kills the other as well. What vital resources are being shared here, and what is the recommended way of spawning multiple Writers (i.e. opening multiple documents) simultaneously? There’s more information in the forum’s post.


Maybe the real question is how to close a document without forcing
soffice process (which is shared in your case among all open documents)
shutdown?

--
Best regards,
Mike Kaganski
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

Hi Mike,

That would be a good answer to have, because finding documentation on this topic is tricky. Here is how I currently handle this in Python:

    pipe = …
    p = subprocess.Popen("/…/soffice --accept='pipe,name=" + pipe + ";url;StarOffice.ServiceManager' --headless --invisible", shell=True)
    # Wait for the pipe to become available.
    local = uno.getComponentContext()
    resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver”, local)
    context = resolver.resolve("uno:pipe,name=" + pipe + ";urp;StarOffice.ComponentContext")
    desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
    # Load the document
    docfile = …
    document = desktop.loadComponentFromURL("file://" + docfile, "_blank", 0, props)

This creates a new office process and open the Writer document and connects to it. Note the absence of the custom user installation (for performance reasons)! Once I’m done with it, then:

    document.close(True) # or if XCloseable doesn’t exist: document.dispose()
    desktop.terminate()                                                                      
    # context.??                                                                            
    # resolver.??                                                                            
    # local.??                                                                              
    p.terminate()                                                                            

The termination of the process p seems to destroy the other running soffice process. Hence using custom user installations with -env:UserInstallation=/tmp/random-dir but that just prolongs the process creation noticeably!

Thanks!
Jens


> On Oct 19, 2017, at 16:48, Kaganski Mike <[hidden email]> wrote:
> Hi,
>
> Maybe the real question is how to close a document without forcing
> soffice process (which is shared in your case among all open documents)
> shutdown?
>
> --
> Best regards,
> Mike Kaganski
>

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Kaganski Mike Kaganski Mike
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

On 10/19/2017 10:05 AM, Jens Tröger wrote:

> Hi Mike,
>
> That would be a good answer to have, because finding documentation on this topic is tricky. Here is how I currently handle this in Python:
>
>      pipe = …
>      p = subprocess.Popen("/…/soffice --accept='pipe,name=" + pipe + ";url;StarOffice.ServiceManager' --headless --invisible", shell=True)
>      # Wait for the pipe to become available.
>      local = uno.getComponentContext()
>      resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver”, local)
>      context = resolver.resolve("uno:pipe,name=" + pipe + ";urp;StarOffice.ComponentContext")
>      desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
>      # Load the document
>      docfile = …
>      document = desktop.loadComponentFromURL("file://" + docfile, "_blank", 0, props)
>
> This creates a new office process and open the Writer document and connects to it. Note the absence of the custom user installation (for performance reasons)! Once I’m done with it, then:
>
>      document.close(True) # or if XCloseable doesn’t exist: document.dispose()

Wouldn't that be enough? Why do you need other cleanup?
Supposedly having the soffice process ready for other incoming requests
would not harm the server operation, and closing the document should
have released any document-specific resources allocated.

>      desktop.terminate()
>      # context.??
>      # resolver.??
>      # local.??
>      p.terminate()
>
> The termination of the process p seems to destroy the other running soffice process. Hence using custom user installations with -env:UserInstallation=/tmp/random-dir but that just prolongs the process creation noticeably!
>
> Thanks!
> Jens
>
>
>> On Oct 19, 2017, at 16:48, Kaganski Mike <[hidden email]> wrote:
>> Hi,
>>
>> Maybe the real question is how to close a document without forcing
>> soffice process (which is shared in your case among all open documents)
>> shutdown?
>>
>> --
>> Best regards,
>> Mike Kaganski
>>
>
> --
> Jens Tröger
> http://savage.light-speed.de/
>

--
Best regards,
Mike Kaganski
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Tor Lillqvist-2 Tor Lillqvist-2
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Jens Tröger

This creates a new office process

Are you sure it does? If you already have a soffice.bin running, does this indeed start a new one, or connect to the existing one? 
  
    desktop.terminate()

If there indeed is just one soffice.bin process running (this is on Windows or Linux, right?), I suspect this will terminate it.

Also, you keep talking about "soffice process", but the real LibreOffice process is called "soffice.bin" (on Windows and Linux; on macOS it indeed is called "soffice"). The "soffice" (or "soffice.exe" on Windows) program is just a thin wrapper that starts soffice.bin when necessary.

--tml

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Matthew Francis Matthew Francis
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Jens Tröger
On 19 October 2017 at 15:05, Jens Tröger <[hidden email]> wrote:
> The termination of the process p seems to destroy the other running soffice process. Hence using custom user installations with -env:UserInstallation=/tmp/random-dir but that just prolongs the process creation noticeably!

One alternative to allowing LO to create a new user installation each
time (which will indeed be slow) is to create a fresh user
installation once, save it somewhere as a template, then make a new
copy of the template directory each time - a file level copy should be
considerably faster.
You can accomplish this simply in Python using shutil.copytree()

Some sample code appended below - this is hacked out from a previous
project, and may or may not represent best practice as to how to do
this, but does work.

Regards
Matthew Francis


#!/usr/bin/python3

import os
import re
import shutil
import subprocess
import tempfile
import time
import uno
import uuid

from com.sun.star.connection import NoConnectException

sofficePath = '/usr/bin/soffice'
tempDir = tempfile.mkdtemp()

# Restore cached profile if available
userProfile = tempDir + '/profile'
cacheDir = os.getenv('XDG_CACHE_DIR', os.environ['HOME'] + '/.cache')
+ '/lo_profile_cache'
if os.path.isdir(cacheDir):
    shutil.copytree(cacheDir, userProfile)
    profileCached = True
else:
    os.mkdir(userProfile)
    profileCached = False

# Launch LibreOffice server
pipeName = uuid.uuid4().hex
args = [
    sofficePath,
    '-env:UserInstallation=file://' + userProfile,
    '--pidfile=' + tempDir + '/soffice.pid',
    '--accept=pipe,name=' + pipeName + ';urp;',
    '--norestore',
    '--invisible'
]
sofficeEnvironment = os.environ
sofficeEnvironment['TMPDIR'] = tempDir
proc = subprocess.Popen(args, env=sofficeEnvironment, preexec_fn=os.setsid)

# Open connection to server
for i in range(100):
    try:
        localContext = uno.getComponentContext()
        resolver =
localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
localContext)
        context =
resolver.resolve("uno:pipe,name=%s;urp;StarOffice.ComponentContext" %
pipeName)
        break
    except NoConnectException:
        time.sleep(0.1)
        if i == 99:
            raise

# Cache profile if required
if not profileCached:
    shutil.copytree(userProfile, cacheDir)


desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",
context)
desktop.loadComponentFromURL('private:factory/swriter', 'blank', 0, ())

# ... clean up temporary directory when done (omitted)
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Matthew Francis Matthew Francis
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

On 19 October 2017 at 16:26, Matthew Francis <[hidden email]> wrote:
> Some sample code appended below - this is hacked out from a previous
> project, and may or may not represent best practice as to how to do
> this, but does work.

... and the same code as a github gist, because I should know better
than to paste wide code in an email

https://gist.github.com/mjayfrancis/164e8956113b7119b4e71cb8d4bd41ed
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

In reply to this post by Matthew Francis
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


> On Oct 19, 2017, at 18:26, Matthew Francis <[hidden email]> wrote:
>
> On 19 October 2017 at 15:05, Jens Tröger <[hidden email]> wrote:
>> The termination of the process p seems to destroy the other running soffice process. Hence using custom user installations with -env:UserInstallation=/tmp/random-dir but that just prolongs the process creation noticeably!
>
> One alternative to allowing LO to create a new user installation each
> time (which will indeed be slow) is to create a fresh user
> installation once, save it somewhere as a template, then make a new
> copy of the template directory each time - a file level copy should be
> considerably faster.
> You can accomplish this simply in Python using shutil.copytree()
>
> Some sample code appended below - this is hacked out from a previous
> project, and may or may not represent best practice as to how to do
> this, but does work.
>
> Regards
> Matthew Francis
>
>
> #!/usr/bin/python3
>
> import os
> import re
> import shutil
> import subprocess
> import tempfile
> import time
> import uno
> import uuid
>
> from com.sun.star.connection import NoConnectException
>
> sofficePath = '/usr/bin/soffice'
> tempDir = tempfile.mkdtemp()
>
> # Restore cached profile if available
> userProfile = tempDir + '/profile'
> cacheDir = os.getenv('XDG_CACHE_DIR', os.environ['HOME'] + '/.cache')
> + '/lo_profile_cache'
> if os.path.isdir(cacheDir):
>    shutil.copytree(cacheDir, userProfile)
>    profileCached = True
> else:
>    os.mkdir(userProfile)
>    profileCached = False
>
> # Launch LibreOffice server
> pipeName = uuid.uuid4().hex
> args = [
>    sofficePath,
>    '-env:UserInstallation=file://' + userProfile,
>    '--pidfile=' + tempDir + '/soffice.pid',
>    '--accept=pipe,name=' + pipeName + ';urp;',
>    '--norestore',
>    '--invisible'
> ]
> sofficeEnvironment = os.environ
> sofficeEnvironment['TMPDIR'] = tempDir
> proc = subprocess.Popen(args, env=sofficeEnvironment, preexec_fn=os.setsid)
>
> # Open connection to server
> for i in range(100):
>    try:
>        localContext = uno.getComponentContext()
>        resolver =
> localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
> localContext)
>        context =
> resolver.resolve("uno:pipe,name=%s;urp;StarOffice.ComponentContext" %
> pipeName)
>        break
>    except NoConnectException:
>        time.sleep(0.1)
>        if i == 99:
>            raise
>
> # Cache profile if required
> if not profileCached:
>    shutil.copytree(userProfile, cacheDir)
>
>
> desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",
> context)
> desktop.loadComponentFromURL('private:factory/swriter', 'blank', 0, ())
>
> # ... clean up temporary directory when done (omitted)
>

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Matthew Francis Matthew Francis
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

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
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

Thank you everybody for your feedback, that was very helpful. Here’s my current working implementation:

- Spawn the soffice process which will function as a “server”

    customenvdir = tempfile.TemporaryDirectory()
    p = subprocess.Popen("soffice --accept=\"pipe,name=SOME_PIPE;url;StarOffice.ServiceManager\" --headless --invisible")

- Terminate the soffice process when I need to

    p.terminate()                                                                              
    # I assume that the pipe will be cleaned up as well?
    if customenvdir:                                                                          
        cleanup_tmp(customenvdir)                                                      

- Having soffice running, I can connect to it as usual:

    try:
        local = uno.getComponentContext()                                                          
        resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local)
        context = resolver.resolve("uno:pipe,name=SOME_PIPE;url;StarOffice.ComponentContext")
        desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
        document = desktop.loadComponentFromURL("file://…", "_blank", 0, None)
        controller = document.getCurrentController()                                                    
    except:                                                                                        
        pass # Handle

- When done with the document, "close" it down but leave the soffice process untouched and available for more. Here, I am not sure about the other resources that were allocated when documents are being loaded:

    # controller.??                                                                            
    if document:                                                                              
        # https://forum.openoffice.org/en/forum/viewtopic.php?f=25&t=75367                         
        if has_interface(document, "com.sun.star.util.XCloseable"):                            
            document.close(True)                                                              
        else:                                                                                      
            document.dispose()                                                                
    # desktop.terminate()                                                                      
    # context.??                                                                              
    # resolver.??                                                                              
    # local.??                                                                                

As Tor suspected, I noticed that desktop.terminate() removes access to the pipe so that others can not open documents anymore. However, it doesn't seem to terminate the soffice process itself.

Also, I have performance concerns for this approach: loading and running through just two documents simultaneously seemed to be unproportionally slow!?

Thank you!
Jens

--
Jens Tröger
http://savage.light-speed.de/
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Matthew Francis Matthew Francis
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

On 20/10/2017 10:04, Jens Tröger wrote:

> Also, I have performance concerns for this approach: loading and running through just two documents simultaneously seemed to be unproportionally slow!?

As I mentioned before, while a single LO process can serve multiple
clients simultaneously, and with low latency for starting a request, it
will likely struggle to fully utilise all the threads of a modern CPU.

I believe you still haven't mentioned what the specific use case you're
trying to achieve is - what are its requirements for interactiveness
and/or throughput? (i.e. is it an interactive process that will
primarily require low latency, a bulk process that requires high overall
throughput but may not mind if individual requests are delayed for a
short time, or something that requires both low request latency and high
throughput?)

If you need both the lowest request latency and the highest throughput
on a single machine, you may need to try adopting a hybrid model - start
a pool of independent LO instances of an appropriate size for your
number of CPU threads, then feed them jobs one at a time each. There is
definitely no canned answer for this, so you would have to do your own
benchmarking and tuning to find the optimum pool size for the resources
of your local machine.

Regards
Matthew Francis
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

Thanks Matthew,

What I need is "bulk processing" of documents. I currently run LO in headless mode and open the documents in read-only format (macros disabled) hoping that would improve performance. To answer to your points: no interactiveness and high throughput to scrape document content.

Your suggestion of running a pool of LO instances seems to be implemented by the oodaemon (https://sourceforge.net/projects/oodaemon/) that I mentioned earlier, but the project seems quite dated.

Cheers,
Jens


> On Oct 20, 2017, at 13:24, Matthew J. Francis <[hidden email]> wrote:
>
> As I mentioned before, while a single LO process can serve multiple clients simultaneously, and with low latency for starting a request, it will likely struggle to fully utilise all the threads of a modern CPU.
>
> I believe you still haven't mentioned what the specific use case you're trying to achieve is - what are its requirements for interactiveness and/or throughput? (i.e. is it an interactive process that will primarily require low latency, a bulk process that requires high overall throughput but may not mind if individual requests are delayed for a short time, or something that requires both low request latency and high throughput?)
>
> If you need both the lowest request latency and the highest throughput on a single machine, you may need to try adopting a hybrid model - start a pool of independent LO instances of an appropriate size for your number of CPU threads, then feed them jobs one at a time each. There is definitely no canned answer for this, so you would have to do your own benchmarking and tuning to find the optimum pool size for the resources of your local machine.
>
> Regards
> Matthew Francis

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

Hi again :)

Just wanted to follow up on this thread. Running multiple Writers in the same (single) soffice.bin process seems to incur noticeable performance penalties. Therefore, in order to run several soffice.bin processes:

  - Get a uuid string.
  - Create random folder in /tmp/soffice-dir-uuid for the soffice.bin process.
  - Optional as Matthew Francis suggested: copy a cached soffice folder into /tmp/soffice-dir-uuid (to improve startup performance).
  - Run soffice --headless --accept="pipe,name=soffice-pipe-uuid;urp;StarOffice.ServiceManager" -env:UserInstallation=file:///tmp/soffice-dir-uuid  (Or call /path/to/soffice.bin directly.)

This allows me to run multiple processes of soffice, each of which services a single Writer. Is that how it should be done?

I'm curious: it sounded as if multi-threading within a single soffice.bin process is an issue. Any more details on that?

Thanks!
Jens

--
Jens Tröger
http://savage.light-speed.de/
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Tor Lillqvist-2 Tor Lillqvist-2
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?


I'm curious: it sounded as if multi-threading within a single soffice.bin process is an issue. Any more details on that?

What multi-threading? Even when having multiple document windows (for instance, multiple Writer ones) open, LibreOffice does not use multi-threading for that.

Multi-threading is a completely different thing, and used for some special purposes in LibreOffice, not related to whether multiple document windows are open, or just one, or none at all.

--tml



_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?

Boy... really?  All of the office code is a single thread?


On Mon, Oct 23, 2017 at 07:20:06AM +0300, Tor Lillqvist wrote:

>      I'm curious: it sounded as if multi-threading within a single
>      soffice.bin process is an issue. Any more details on that?
>
>    What multi-threading? Even when having multiple document windows (for
>    instance, multiple Writer ones) open, LibreOffice does not use
>    multi-threading for that.
>
>    Multi-threading is a completely different thing, and used for some
>    special purposes in LibreOffice, not related to whether multiple
>    document windows are open, or just one, or none at all.
>
>    --tml

--
Jens Tröger
http://savage.light-speed.de/
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Tor Lillqvist-2 Tor Lillqvist-2
Reply | Threaded
Open this post in threaded view
|

Re: How to run multiple instances of Writer simultaneously?



On 23 October 2017 at 11:31, Jens Tröger <[hidden email]> wrote:
Boy... really?  All of the office code is a single thread?


Most of the actual "work" on documents, yes.

(Except that Calc has for some years been able to use OpenCL (and thus parallelism, on the GPU even) for some calculations, on platforms where supported well enough. There is also work ongoing to make Calc calculate in parallel using "plain" threaded code, i.e., not using OpenCL or any other "extra" technology.)

--tml

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Next » 12