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

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

BrianH
5-Dec-2010
[9319]
Both are supported by the protocol, afaik, depending on the particular 
server settings.
Kaj
5-Dec-2010
[9320]
Serialised operation would be easier, until R3 gets proper tasking
Dockimbel
5-Dec-2010
[9321]
FastCGI requests are serialized by Cheyenne, but without tasking, 
R3 will still process one at a time, so any blocking call or long 
processing will block the whole server.
Kaj
5-Dec-2010
[9322]
The R3 server, right, not Cheyenne?
BrianH
5-Dec-2010
[9323x2]
In theory FastCGI can support app pools, for multiprocessing rather 
than multithreading (iirc from the docs).
You might have to roll your own app pools though, like Cheyenne does 
for RSP requests.
Kaj
5-Dec-2010
[9325]
App pools running in separate processes?
BrianH
5-Dec-2010
[9326]
Seperate R3 interpreter instances.
Kaj
5-Dec-2010
[9327x2]
Yes. I'm not very interested in those, because if I would make an 
app server, it would be to cache my app. I probably wouldn't want 
multiple processes of the app server, because the caching would multiply
That model is already supported in Cheyenne. The drawback is that 
it has to be wrtten in R2
BrianH
5-Dec-2010
[9329]
The main plus for FastCGI of REBOL is to cut down on startup overhead. 
You can do things with persistent state too.
Kaj
5-Dec-2010
[9330]
Yes, plus the startup overhead of the app
BrianH
5-Dec-2010
[9331]
Yup. The downside to app pools is that you have to coordinate access 
to the data amongst multiple interpreter instances (less cache, more 
disk access), but that's not as big a problem for mostly-read apps.
Kaj
5-Dec-2010
[9332]
Yeah, I'm mostly concerned about optimising the read case
Dockimbel
5-Dec-2010
[9333]
Cheyenne has some experimental support for FastCGI multiple server 
instances (multiprocessing) but this has never been really tested. 
The balancing is very simple, distributing requests using a simple 
round-robin method. Pool managment is minimalistic, starting all 
the instances and killing them on Cheyenne's quitting, no restarting 
or failover handling.
Kaj
5-Dec-2010
[9334]
Interesting. So unlike UniServe, there's a fixed number of instances, 
and requests to one instance are serialised? That would be quite 
workable
Dockimbel
5-Dec-2010
[9335x2]
UniServe worker processes don't support multiplexed requests (multiplexing 
is the right word used in FastCGI specs IIRC). The FastCGI multiplexing 
mode requires a form of multitasking support to be able to handle 
all the incoming requests in a multiplexed way. Without that, you'll 
end up with just multiprocessing, which is what UniServe+Taskmaster 
are doing for CGI and RSP scripts.
For example, PHP in FastCGI mode supports multiplexed requests over 
a single FastCGI socket, while dispatching the load internally between 
several PHP processes (or thread under Windows). In that mode, the 
main PHP process manages the thread/process pool alone, and starts 
new instances when required.
Pekr
5-Dec-2010
[9337]
also remember the session afinity patch, which was added to FastCGI 
later ... ensuring that the same session goes to the same process 
instance
Kaj
5-Dec-2010
[9338]
Speaking of session affinity, how does Cheyenne do that generally? 
If you serialise the requests for one session to one UniServe task 
master, they must be queued, right?
Dockimbel
6-Dec-2010
[9339x2]
There's no need for session affinity internally in Cheyenne, the 
session context is carried with the request to any worker process.


CGI/RSP requests are dispatched to any available worker process. 
If all are busy, a new one is forked up to the maximum number (8 
by default). If the max number of workers is reached and all are 
busy, the request is queued (the queue is global). Once a worker 
becomes available, it gets a new request assigned at once.
Btw, worker processes are not equal wrt the load. The first in the 
list gets the more jobs to do, especially if requests can be processed 
fast (which should be the case in most of well-coded scripts). So, 
you get a natural "affinity" to the first worker (having the most 
code and data cached there) for all new incoming requests. 

So, in the long run, you can look at workers memory usage to see 
how the workload is spread, the first one having the biggest memory 
usage, the last one having the lowest. Looking at the last one is 
a good indicator if the number of workers needs to be raised or not, 
if his memory footprint hasn't changed since the last restart, your 
server is doing fine with the load. I should expose some workers 
and job queue usage stats to help fine tune workers numbers.
Kaj
6-Dec-2010
[9341x2]
Thanks, good to know
I do see the asymmetry on our server. I have also had cases, though, 
where the number of workers went above eight or to zero. I'm not 
sure if that is still happening with the recent version
Dockimbel
6-Dec-2010
[9343]
The worker number doesn't decrease unless you're using the -w command 
line option (or unless your code or a native bug crash some of them 
badly). Having more than 8 workers is possible if some of them are 
blocked (in a endless loop or waiting something forever). If you 
quit Cheyenne in that case, they'll remain there and will need manual 
killing. Cheyenne could do a better job at handling those non-responding 
workers in future versions.
Steeve
6-Dec-2010
[9344]
R3 is more suited for such.
secure [memory integer!] and secure [eval integer!]
Allow to quit from forever loops.
(Not from a forever loop, which does nothing, though)
Gregg
6-Dec-2010
[9345]
And perhaps
  secure [time time!]
Steeve
6-Dec-2010
[9346x2]
yeah perhaps... is there a ticket for that request ?
I I guess, Carl didn't want offer this by default, because the slow 
down may  be drastic.
Gregg
8-Dec-2010
[9348]
I don't know if there's a ticket. I could live with relatively coarse 
granularity, which would be much better than nothing, if that at 
least made it possible.
Pekr
8-Dec-2010
[9349]
At least a memory constraint is a good one. That should prevent memory 
leakage. I personally don't like eval at all, as my brain is not 
mature enough to be able to guess, how many cycles will my script 
ideally need. I would welcome time constraint as well, and it was 
proposed, but not accepted.

Here's what does not work yet:


# If the program quits, the exit code is set to 101, the same as 
any security termination; however, we may want to use special codes 
to indicate the reason for the quit.

# Some types of loops are not yet checked, but we will add them. 
For example, PARSE cycles are not yet counted.

# Time limits are not yet supported, but may be added in the future. 
However, the cycle limit is better for most cases, because it is 
CPU speed independent.
Steeve
8-Dec-2010
[9350]
You can quit/return any exit code
Kaj
8-Dec-2010
[9351]
It's about automatic quits by the SECURE functionality
Steeve
9-Dec-2010
[9352]
yeah, and you can catch it as an error. It stay relevant.
Kaj
9-Dec-2010
[9353]
Yeah, but you can't analyse the error, because you always get 101
Steeve
9-Dec-2010
[9354x2]
Are you sure ? accordingly the doc, we got :

>> secure [eval [throw 50000]]
>> loop 100000 [next "test"]
** Access error: security violation: eval
** Where: loop
** Near: loop 100000 [next "test"]


So, you can decipher the error message and send back the appropriate 
quit/return code
security violation: eval
BrianH
9-Dec-2010
[9356]
You can also do it in a try statement and check the error codes.
Kaj
9-Dec-2010
[9357]
Ah, seems this limitation only applies then if you let R3 quit without 
further processing
AdrianS
10-Dec-2010
[9358]
Bad news - looks like WebSockets will be disabled in Firefox 4 due 
to security concerns.


http://feedproxy.google.com/~r/Bludice/~3/S6Lw15UdA2I/websocket-security
Andreas
10-Dec-2010
[9359]
Same in Chrome: http://codereview.chromium.org/5643005/
Kaj
10-Dec-2010
[9360]
Aargh
Dockimbel
10-Dec-2010
[9361]
I saw the news yesterday for FF4. The badly written RFC for ws was 
alarming since the beginning, this kind of design defect doesn't 
surprise me much, but it's such a waste...I hope the new CONNECT-based 
workaround will be adopted rapidly.
Kaj
10-Dec-2010
[9362]
Google can't hire designers as good as work for REBOL for free ;-)
nve
18-Dec-2010
[9363]
When can we exepect Cheyenne like NGINX ? What is missing ? Cheyenne 
is the best product to promote REBOL !?
Oldes
18-Dec-2010
[9364]
Why? I'm using Cheyenne with Nginx... Nginx for serving static content, 
dynamic by Cheyenne. I use slogan:  "when east meets west".
nve
18-Dec-2010
[9365]
Ok,  they claimed that "Nginx now hosts nearly 6.55% (13.5M) of all 
domains worldwide."
When for Cheyenne ?
GrahamC
18-Dec-2010
[9366]
There's a possibility that users might require certificates to access 
my app ... can that be done with Cheyenne and something else?
Andreas
18-Dec-2010
[9367]
Client certificates?
GrahamC
18-Dec-2010
[9368]
So, what would you have to use server side to manage and authenticate 
the certificates?