From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Re: Re: org batch job using emacsclient? Date: Tue, 17 Nov 2009 13:16:22 +0100 Message-ID: <87ws1pgxd5.fsf@gmx.de> References: <4A2B8DB1-1A56-40CA-B972-E44C16F9DD1E@nf.mpg.de> <873a4e329l.fsf@dynapse.com> <9F07BE57-B87D-4433-8489-4CDD268EC638@nf.mpg.de> <87bpj13n1d.fsf@gmx.de> <356457CA-71F2-4B5D-ABB8-26E45B7042CD@nf.mpg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAMzG-0000A1-DK for emacs-orgmode@gnu.org; Tue, 17 Nov 2009 07:16:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAMzB-00008I-7g for emacs-orgmode@gnu.org; Tue, 17 Nov 2009 07:16:45 -0500 Received: from [199.232.76.173] (port=58775 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAMzB-00008D-0S for emacs-orgmode@gnu.org; Tue, 17 Nov 2009 07:16:41 -0500 Received: from mail.gmx.net ([213.165.64.20]:58655) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1NAMzA-0000IJ-9K for emacs-orgmode@gnu.org; Tue, 17 Nov 2009 07:16:40 -0500 In-Reply-To: <356457CA-71F2-4B5D-ABB8-26E45B7042CD@nf.mpg.de> (Stefan Vollmar's message of "Tue, 17 Nov 2009 10:06:38 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Stefan Vollmar Cc: "Gregory J. Grubbs" , emacs-orgmode Mode Stefan Vollmar 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: ls -l /tmp/emacs1000/ insgesamt 0 srwx------ 1 sebastian sebastian 0 2009-11-17 12:17 server 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