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

Robert
18-Feb-2009
[3923x4]
Thinking about web-app appliances. Not sure if this idea alreaday 
exists but IMO a good thing to think about.


If I have a RSP based web-app (for example my super-cool-all-you-need-shooping-cart 
system) that I would like to sell it would be nice to bundle cheyenne 
and all the RSP stuff into one package. The user just installs it, 
sets up a simple reverse-proxy and has everything up & running.
IMO this would be a killer feature for Cheyenne.
We can't expect people to change their existing web-server. We can't 
expect them to install Rebol interpreter, create new CGI setup etc.


But we can expect people to install something on their system, add 
a little config stuff to the existing setup and have a cool web-app 
up& running.
Most web-apps or modules are just to all-or-nothing. I just want 
a simple thing but get a bunch of stuff I don't want to use but I'm 
forced to.
Pekr
18-Feb-2009
[3927x2]
Very interesting idea. My easy-cgi tries to serve as a "package", 
which can be just copied to any cgi-enabled site. I am at very beginning, 
not really trying to do more than simple cgi stuff, sqlite, sessions 
....
If Cheyenne as a whole could work this way, I might consider using 
it. Other than that, I can't easily replace Apache at hosting location 
....
Robert
18-Feb-2009
[3929x3]
Deploying the RSP stuff in an "encapped" way would be nice too. So 
just one file including cheyenne and all RSP stuff.
The main problem I have with a lot of the available tools is, that 
integrating several of them into one solution is far from easy. There 
is no loose coupling possible.


You need PHP version XYZ with module ABC and libc version IJK etc. 
getting all this to work togehter is horrible. It's fragile and hence 
a nightmare to scale or operate.
Being able to install web-appliances with a smart and simple integration-interface 
would be very cool.


I'm going to try this with the shopping cart stuff. We will see how 
it will work. Adding a simple deploying mechanism shouldn't be that 
hard than.
Dockimbel
18-Feb-2009
[3932x2]
Robert, what your explaining is one of the main goal of Cheyenne. 
:-) Simple, lightweight, all-in-one file web applications deployement. 
Still some work to be able to achieve that, the main missing feature 
is a good and lightweight virtual file system for RSP scripts (so 
you can run them in source form or encapped with Cheyenne without 
changing anything).
Pekr: nowadays, you can have your own private server for less than 
10€/month...
Janko
18-Feb-2009
[3934x2]
well if you don't have reason to hide the sources one exe + one folder 
for rsp/html/image files (so user can also tweak them) doesn't seem 
any worse and already works
yes, vps-s are very accesible now
Robert
18-Feb-2009
[3936x2]
Sure you can rent your own server but this implies that you know 
what to do with it and how to operate it. Something a lot of people 
can't do.
Tweaking: I'm all for it but via a simple dialect driven way. Keep 
it simple. I don't want to hack several CSS, HTML, pre- post-processor 
files etc.
Janko
18-Feb-2009
[3938]
I am not shooting down your idea.. I am just trying to say that cheyenne 
with just simgle -- exe + folder + config file -- already provides 
very deployable webapp solution, compared to for example installling 
apache + php + apache + pear.. and django / ruby (with just development 
server) also wasn't anywhere near as simple to install last time 
I tried
Robert
18-Feb-2009
[3939]
Janko, I agree. It's, let's say, already 80%. I just want to push 
for the 100% :-)
Janko
18-Feb-2009
[3940]
and I can also think of situations where prepackaged app in a single 
exe would be preferred, so I agree back :)
Pekr
18-Feb-2009
[3941]
Dockimbel - I can have my private hosting for something like 10€/month, 
but surely not server. At least not here. And - it is not proper 
answer - sometimes you just want to deploy, not enter into new agreement 
with new server hosting house. That is upon client, not mine decision, 
etc.
Janko
18-Feb-2009
[3942x2]
Pekr: I made a deal to get a smaller VPS in slovenia for my local 
projects. I pay 12EUR and I am currently running one cheyenne webapp, 
2 apache solr engines with multiple 1000 records (search engine / 
indexer),  and a multitude of bots for search engine.. without any 
problems . All VPS-s in slovenia start at 36EUR and are bigger (more 
HD more RAM) , but I started asking various providers if they can 
get me smaller package for smaller fee and I got one :) . If you 
are looking international you have good and cheap VPS-s at Linode 
, I also used miniVDS which is only 5EUR I think (and intend to again 
in future)
I have one question... after working in various other languages + 
mysql/sqlite I am using normal files with rebol structures and LOAD 
for my first projects here. Now I have a little more serrious project 
up so I started thinking if by using just files I can corrupt data 
somehow. I am not that good on low level details, but I imagine that 
I don't have to worry too much. Because cheyenne is single process 
I imagine only single write to file can happen to some file at any 
given time. Am I correct or wrong?
Pekr
18-Feb-2009
[3944x3]
Imo you are wrong.
What you describe would mean, than you can only do one CGI request 
at the time. Cheyenne will launch new CGI process at each request, 
hence your file operations could collide. I like SQLite very much, 
but they don't provide server level functionality. They are able 
to work at file-lock level, but dunno how solid it is ...
If Cheyenne would be able to share handlers between apps, you could 
write small queue handler for db request and use small sqlite DB.
Janko
18-Feb-2009
[3947]
hi Pekr.. no I am not using sqlite .. I am using normal files with 
rebol blocks via LOAD
Pekr
18-Feb-2009
[3948]
Janko - renting external box is not what I regard being a deployment. 
You can't easily request all your customers to move their already 
existing sites to your new hosted server. That is not much practical, 
but I do understand your reasoning ...
Robert
18-Feb-2009
[3949]
Server rental is OT.
Pekr
18-Feb-2009
[3950]
I was just trying to say, that even with SQLite (which solves some 
file access sharing problems), you are accessing one file from multiple 
processes.
Robert
18-Feb-2009
[3951]
Is Cheyenne REST ready?
Janko
18-Feb-2009
[3952x2]
I am not sure if cheyenne starts new process for each request , I 
suspect it uses async sockets and serves request at a time
ok, that is true .. if some company has a website and wants some 
additional app there it's not good option to say relocate it all 
to vps..
Pekr
18-Feb-2009
[3954]
Janko - Cheyenne uses Uniserve multiplexing server IIRC. And AFAIK, 
Uniserve uses two aproaches - if the request can be served quickly, 
you can use one process, but if your request could last longer, you 
define handler or something like that, which spawns new process ...
Robert
18-Feb-2009
[3955]
Janko, if you can ensure that only one request accesses one file 
than you are safe. If not, the last writer will win. But no data-corruption 
will happen.
Janko
18-Feb-2009
[3956]
yes, that is another problem and I am aware of it (basically that 
is not a problem here).. the last writer wins... I am just worried 
if any data corruption can somehow happen
Pekr
18-Feb-2009
[3957]
I think that Robert is very brave with his statement :-) I would 
not bet if data can or can't be opened. If file is not locked, and 
you use write on it, and another process too, you can corrupt data, 
no?
Janko
18-Feb-2009
[3958x4]
that is the same if you have a simpler mysql based webapp.. one person 
starts editing text, another person starts editing , first saves, 
second saves.. first person looses the changes.. that is basically 
problem on application level and is the same here as if using RDBMS
I suspect on the system level at the time one write is in action 
file is locked for all other writes
and if server is uniprocess that can't happen anyway
(if - I am not sure I know exactly how cheyenne works)
Robert
18-Feb-2009
[3962x2]
Petr, the filesystem will ensure that this won't happen. The thing 
is, that for the time you write to the file, you get a file-lock. 
But this is immediatly released after you finished. So, if you try 
to write to a file with a lock, you get an error.
A DB handles this by having one file lock for the database file all 
the time, taking several request at the same time and doinga  DB 
locking scheme on-top of the filesystem locking.
Pekr
18-Feb-2009
[3964x3]
Robert - I can understand, but you access one DB file from separate 
processes, hence separate DB engines.
Is here any DB related group?
DB Chat?
Janko
18-Feb-2009
[3967x2]
Robert - thanks for explanation.. I should of known these things 
but I have been in mysql world too long :)
Pekr a little help for the problem when a existing apache/lamp website 
needs additonal web-app that you would want to write using cheyene 
would be to use Apache's mod_proxy to map just some path to cheyenne 
 > ProxyPass > ProxyPassReverse  -- http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
Dockimbel
18-Feb-2009
[3969]
Cheyenne serves static resources from the main process (UniServe 
process), but CGI and RSP are executed by pre-forked worker processes. 
So yes, writing to the same file from RSP script can be an issue 
if you don't have a mean to ensure that write accesses are serialized. 
I had that issue recently for RSP log/debug file, I had to build 
a small logger service in the main process to be able to serialize 
 write access (after stress testing different file locking solutions 
from REBOL, no one seemed reliable enough to me). 


I thought about adding a synchronization service in Cheyenne that 
could be used to (but not only) address the write file sync issue. 
That could work for low sync needs (like writing to a file once every 
few seconds), but for massive sync needs (dozens or hundreds of sync 
req/s), I'm afraid that the TCP port overhead would be too costly...(maybe 
a separate sync server process with persistent TCP connections could 
be good enough even for heavy uses?)
Janko
18-Feb-2009
[3970]
aha, so rsps work on multiple worker processes, interesting.. well 
I think to me it's not a problem as each user has it's own data files 
so it's hard to imagine multiple writes could happen at the same 
time for the same file. And if I would need something reall y heavy 
duty I would make a server serving files and caching them in ram 
for speed etc, which would also take care for sync. or something 
off the shelf
Dockimbel
18-Feb-2009
[3971]
If you have a page with 2 (or more) frames, each pointing to RSP 
scripts that may all write to user's data file...that could be a 
problem. Same issue if your user opens 2 browser windows, or several 
users using the same account...the risks are not very high, but such 
cases can happen.
Janko
18-Feb-2009
[3972]
since processing of requwest seems to take just 1ms I think chances 
per user are slim. What would happen in it collides? would one of 
processes "get file access error" or something worse can happen by 
your exp? (I was asking about the fear of file getting corrup / half 
written before)