[brailleblaster] Re: utdml2brl.temp

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Mon, 14 May 2012 10:44:20 +0100

While synchronized blocks may prevent the issue showing, it might not be the real answer as it can lead to poor performance. In this case this probably is true.


The reason is that synchronized means that other threads have to wait for the current thread to finish the synchronized block. In this case as there are multiple machines and really separate translations should be, well, separate, there should not really be a need to have to do translations sequentially. Sequential translation is not the most efficient/intended way to use a cluster environment.

The original suggestion of having separate temp files for each translation is the correct and fastest way for this to work in a cluster environment. May be having it based on the file name is one solution, another would be to allow the calling application to set the temp file name for the current translation.

Having said the above, even if the file name thing was seen to, there could very well be other bugs with using it in a multi-threaded environment (eg. there may be shared variables which multiple translations both may try to use, etc).

So may be John's suggestion of using synchronized is the only way to do this in the immediate future, significant work could be needed to make liblouisutdml thread safe and so may simply not be the right choice for such a use.

Michael Whapples
On 14/05/2012 03:35, John J. Boyer wrote:
Hi Alex,

If I remember right, you should do something like this

synchronized {
file2brl (arguments);
}

or you could call translateFile within the block.

John

On Sun, May 13, 2012 at 06:46:36PM -0700, Alex Jurgensen wrote:
Hi John,

My translation system consists of aprox 100 Thousand concurrent translations 
over a small cluster of machines. Do you have any advice for how I should 
implement the LibLouisUTDML interface in Java?

Regards,
Alex,




Alex Jurgensen,
Community Coordinator,
The Camp Bowen Society for the Visually Impaired,

Explore Camp Bowen online at: http://www.campbowen.ca/

Phone: 778-908-0521
E-mail: ASquared21@xxxxxxxxx




On 2012-05-13, at 6:37 PM, John J. Boyer wrote:

Hi Alex,

If you are using Java it would be best to use a synchronized block. If a
translation is started while another is in progress they will interfere
with each other, even if you use a method that does not generate
file2brl.temp. Each translation takes only a few seconds, so your users
should not notice much delay.

John

On Sat, May 12, 2012 at 06:13:50PM -0700, Alex Jurgensen wrote:
Hi John,

To add to my previous question, I was wondering if such a feature could work as 
follows:

/usr/bin/file2brl --tempfile /tmp/myfile.temp /home/Alex/myfile.xml 
/home/Alex/myfile.brl

Regards,
Alex,


Alex Jurgensen,
Community Coordinator,
The Camp Bowen Society for the Visually Impaired,

Explore Camp Bowen online at: http://www.campbowen.ca/

Phone: 778-908-0521
E-mail: ASquared21@xxxxxxxxx




On 2012-05-12, at 5:23 PM, John J. Boyer wrote:

Hi Alex,

I assume you are referring to file2brl.temp This file is overwritten
each time the file2brl command-line program or the file2brl method in
the Java bindings is run. It is not intended for any permanent use, but
may be useful for debuging. What are your reasons for wanting a file
name that reflects the source file?

Thanks,
John

On Sat, May 12, 2012 at 01:06:56PM -0700, Alex Jurgensen wrote:
Hi John,

Is it possible to have LibLouisUTDML create a temporary file that is not named utdml2brl.temp, but 
rather, uses the name of the source document one is translating? For example, 
"file1.temp" or "file2.temp"

Regards,
Alex,

Alex Jurgensen,
Software Engineer,
ASInnovations,

"We might be blind, but we have a vision."

Phone: 778-908-0521
E-mail: VoiceOverTrainer@xxxxxx

--
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities


--
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities




Other related posts: