emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Stefan Vollmar <vollmar@nf.mpg.de>
Cc: "Gregory J. Grubbs" <gregory@dynapse.com>,
	emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: Re: Re: org batch job using emacsclient?
Date: Tue, 17 Nov 2009 13:16:22 +0100	[thread overview]
Message-ID: <87ws1pgxd5.fsf@gmx.de> (raw)
In-Reply-To: <356457CA-71F2-4B5D-ABB8-26E45B7042CD@nf.mpg.de> (Stefan Vollmar's message of "Tue, 17 Nov 2009 10:06:38 +0100")

Stefan Vollmar <vollmar@nf.mpg.de> writes:

> Dear Sebastian,
>
> many thanks for your detailed reply!
>
> On 17.11.2009, at 03:25, Sebastian Rose wrote:
>
>>> To start with, it now works for me and I can measure a consistent speedup of
> 7x
>>> (!) for using emacsclient - in an interactive web service (conversion of
>>> org-files to HTML) the difference between 0.35 s and 2.40 s (average) is
>>> significant.
>> 
>> That was to be expected :)
>
> I had certainly hoped so. However, this performance is still disappointing
> considering the "horse power" of modern systems - and this although I checked
> that all Lisp sources have been compiled. But I will now officially stop
> whining: < 0.5 s for a typical interactive query is acceptable from a user's
> point of view.
>
>>> I have added a (kill-buffer) statement for cleaning up (I observed an
> increasing
>>> number of emacsclient processes before), is this a good solution?
>> 
>>  Does it help? Then I think it's ok.
>> 
>>  The `usual' way to close a server buffer is `C-x #' which is bound to
>>  the function `server-edit'.  That's what I use in org-protocol.el. The
>>  name is somewhat confusing, though.
>
> +1
>
>>     /path/to/emacs -Q -l /etc/emacs-server/init.el --daemon=SERVER-NAME
>>     /path/to/emacsclient --no-wait --socket-name=SERVER-NAME xy.org
>
> (1) I have changed the code to 
>
> #!/bin/sh
> emacsclient --no-wait -s org
> --eval "(progn
> (add-to-list 'load-path \"/opt/org-6.33c/lisp/\")
> (require 'org)(require 'org-exp)
> (setq org-export-headline-levels 2)
> (find-file \"$1\")
> (org-export-as-html 2 nil nil nil nil \".\"))"
>
> omitting the (kill-buffer) is a speed improvement and no emacsclient processes
> remain - nice! However, what happens to any buffers, temporary or otherwise,
> created during org conversion - will they accumulate in the server process?

Hm - I'd guess so. You could find out by simply opening lots of files
the way you use emacsclient.

Doing

  for f in $(find /etc/ -type f -name '*conf'); do
     emacsclient --no-wait "${f}";
  done

makes my emacs process grow quite a bit, as `ps aux | grep emacs' shows
:-D

Maybe even add a function to your emacs-server to log the opening and
closing of files together with a timestamp? E.g. advising `find-file'
and `kill-buffer'.



> (2) I have not tried but it is probably important to start emacs-server as the
> same user who is then going to run emacsclient (root vs webservd)?


I did - it is necessary, since the socket is read- and writeonly for the
owner:

  <sebastian@beteigeuze:/home/sebastian> ls -l /tmp/emacs1000/
  insgesamt 0
  srwx------ 1 sebastian sebastian 0 2009-11-17 12:17 server
  <sebastian@beteigeuze:/home/sebastian> su - emacs22
  Passwort:
  emacs22@beteigeuze:~$ /usr/local/bin/emacsclient --no-wait -s \
                        /tmp/emacs1000/server xy.org
  /usr/local/bin/emacsclient: can't stat /tmp/emacs1000/server: Permission denied
  /usr/local/bin/emacsclient: error accessing socket "/tmp/emacs1000/server"



  



> (3) 
>>  Are you familiar with init.d stuff? There is an example file somewhere
>>  on Debian...
>>  http://github.com/SebastianRose/denycc/blob/master/scripts/rc.denycc
>>  is made from such an example file for Debian 4.0
>
> Yes, I still grew up with this. However, this is (slightly) deprecated on
> Solaris 10: we are supposed to use services instead,
> http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.jsp (I have been
> happily using this feature of Solaris 10 but so far not created a new service
> which would be required here).

Is this in OpenSolaris that way too? I should install it in my VM.

On Linux we now have this /etc/event.d/ - I think I read something about
it... the /etc/init.d/rcX mechanism has changed somehow. Not sure
though. I have put this on my list.



Best wishes

  Sebastian

      reply	other threads:[~2009-11-17 12:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16  8:51 org batch job using emacsclient? Stefan Vollmar
2009-11-16 11:07 ` Noorul Islam K M
2009-11-16 11:13 ` Adam Spiers
2009-11-16 14:07 ` Magnus Henoch
2009-11-16 15:41 ` Gregory J. Grubbs
2009-11-17  0:12   ` Stefan Vollmar
2009-11-17  2:25     ` Sebastian Rose
2009-11-17  9:06       ` Stefan Vollmar
2009-11-17 12:16         ` Sebastian Rose [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ws1pgxd5.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=gregory@dynapse.com \
    --cc=vollmar@nf.mpg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).