r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Uniserve] Creating Uniserve processes

Dockimbel
1-Mar-2008
[553x2]
So, you should be concerned about not doing heavy computation inside 
network event callbacks (like in 'on-received). If longer processing 
is needed, you should use the task-master service in Uniserve to 
send the request to a slave process (this has also the advantage 
of fully using the power of modern multicores processors).
To determine if you can leave the work inside the callback, just 
do some simple maths. E.g., if a request needs 50ms to be processed, 
that means that your server cannot do more than 20req/s. So it also 
depends on the load your server need to handle.
[unknown: 5]
1-Mar-2008
[555]
I would most likely have a lot of that going on with TRETBASE since 
the searches could take some time to produce results.
Dockimbel
2-Mar-2008
[556]
In that case, you need to rely on slave processes, each one executing 
TRETBASE. This means that you have to set up a distributed architecture, 
think about disk-writing synchronization between slaves, caches consistency,... 
All these could be easier done if we had multi-threading support 
in REBOL. It can be done without, but it's more complex and much 
less efficient.
Kaj
2-Mar-2008
[557]
I'm currently integrating the UniServe software stack into Syllable 
Server
[unknown: 5]
2-Mar-2008
[558]
Thanks Doc.
BrianH
2-Mar-2008
[559x2]
Paul, you'd still need to think about all of those concurrent consistency 
problems if you went multi-threaded. Without serialization of some 
form, concurrent use will still be an issue, whether you are using 
processes or threads.
Not discouraging you, just warning you :)
[unknown: 5]
2-Mar-2008
[561]
I do see the problem Brian.
BrianH
2-Mar-2008
[562]
Of course.
[unknown: 5]
2-Mar-2008
[563]
I think that Doc has the most available and supported Async offering 
right now that can even quality for my needs.
BrianH
2-Mar-2008
[564]
I wonder if it would make sense to make some kind of a multi-LNS 
layer over Uniserve.
[unknown: 5]
2-Mar-2008
[565]
Wouldn't LNS currently have the same problem as Uniserve with respect 
to mono-processing?
BrianH
2-Mar-2008
[566]
You could take advantage of Uniserve's task dispatch and process 
management to do load balancing between LNS servers.
Graham
19-Oct-2008
[567x2]
Doc, what I want to do is do some text to speech using a 3rd party 
web service.  I need to download the generated wave file and play 
it by inserting it into a sound port.

The read would be blocking if I use sync read, and then playing it 
thru a sound port in my experience does interfere with async tcp.

In a nutshell, is this sort of activity suitable for a task-master 
service .. and is there a simple sample of such a service?
The task would be triggered from an RSP page
Since any client could be accessing the cheyenne server, I want a 
response returned immediately so that it doesn't block the client. 
 And the sound can be played later on ...
Dockimbel
19-Oct-2008
[569]
So, if I understand correcty, you need to download a file on client 
side from a web server without blocking on the client side ?
Terry
19-Oct-2008
[570x2]
You can't send a response, then another and another unless you use 
Comet technologies
Which means leaving the connection open.. not sure how Cheyenne would 
deal with this
Graham
19-Oct-2008
[572x2]
I've got Univserve/cheyenne running on localhost.  I want my client 
to ask uniserve to download a file using one of it's processes and 
then play it through a sound port.  My client uses a http request 
and wants that to be non blocking ie. return immediately.  The client 
may itself not be capable of doing an async request.
eg. 
client => read http://localhost/speak.rsp?txt=helloworld

speak.rsp
<% 

 data: read/binary http://somewebserivice/cgi-bin/to-wave?text=helloworld
	insert sound-port  data
%>
<html></html>


in this scenario the client has to wait for the response.  How would 
one send the empty result back immediately, and then process the 
request so that the client is not blocked and where the client is 
incapable of an async read
Dockimbel
19-Oct-2008
[574]
You can't send back a response to the client without ending the RSP 
processing. Uniserve is not loaded in helper processes, so you can 
issue async read requests. Is your client REBOL-based ?
Graham
19-Oct-2008
[575x3]
Just thinking of creating a general purpose app so not necesssarily
So, I guess I just need to use call instead which is async and returns 
immediately
ie. don't wait for the result
Dockimbel
19-Oct-2008
[578]
Right, you use LAUNCH or CALL.
Graham
19-Oct-2008
[579x2]
is there a way to get one of those helper processes to do this?
ie. to run the call for me?
Dockimbel
19-Oct-2008
[581]
Do it in your speak.rsp, it should be ok as long as your call/launch 
is not blocking.
Graham
19-Oct-2008
[582x2]
ahh... okay, since speak.rsp is already been run by one of those 
helper processes
silly me
Dockimbel
19-Oct-2008
[584x2]
exactly
...for the helper process (not you being silly) ;-)
Graham
19-Oct-2008
[586]
:)
PeterWood
19-Oct-2008
[587]
Graham: Have you consiered the alternative approach of calling a 
text-to-speech program on the client?


Of course, this facility is builtin to Mac OS.Google pointed me to 
this for other clients :
http://www.cstr.ed.ac.uk/projects/festival/download.html
Graham
19-Oct-2008
[588x2]
Peter, yes, but I'm not aware of such facility on Linux.
And there are some web services that provide much higher quality 
than MS's speech.
PeterWood
19-Oct-2008
[590]
Festival appears to run on Linux, BSD, Solaris and Wndows...only 
Mac seems to be missing from the list.
Graham
19-Oct-2008
[591x3]
Oh ..., I put Festival in the too hard basket long time ago :)
But really I was enquiring about the principle involved in running 
a blocking process on Uniserve.
I wonder how just opening a port to Cheyenne and inserting the command, 
and then closing immediately would work??
PeterWood
19-Oct-2008
[594]
I think I'll have to put that in my too hard basket :)
Dockimbel
20-Oct-2008
[595]
Closing just after sending command : should work.
DanielP
14-Dec-2008
[596]
Hello, how can I choose the name of a server (other than "localhost") 
?
Graham
14-Dec-2008
[597]
host file
Oldes
15-Dec-2008
[598]
( WINDOWS\system32\drivers\etc\hosts )
Oldes
18-Jan-2009
[599x3]
What would be the best way how to limit server's output bandwidth 
using Uniserve? For example if i would like to write a stream server.
I guess by starting Uniserve as uniserve/boot/no-loop and providing 
own forever loop, am I right?
And in the loop write only so much data, as needed into connected 
clients.
Dockimbel
19-Jan-2009
[602]
The forever loop is : wait [ ]. How can you provide your own one? 
Limiting bandwidth would require control of data sent per seconds 
from 'on-write UniServe's callback. That means storing a timestamp 
of last sent packet and calculating the length of next packet based 
on time passed from last sent packet and bandwidth limit.