Web-based Application in Revolution

Thorsten Hohage thohage at objectmanufactur.com
Sun Oct 7 15:35:24 CDT 2007


Hi Andre,

obviously I'm not Ruslan, but I build web-apps for over 10 years and  
I used Valentina in many apps.

On 2007-10-07, at 22:07, Andre Garzia wrote:

> usually when building Revolution web aps, people use apache cgi  
> interface,
> so for each web request, apache will launch an instance of the  
> revolution
> engine. If you have two concurrent requests, you will have two  
> instances
> running.
Yes, this is the common way for most of the dev-environments and for  
"small" solutions. If you really expect high number of concurrent  
users you perhaps should think about using a "real" web-application  
server.


> Each with their own V4REV external loaded. What happens if they
> both try to access the same Valentina database.
Nothing good.


> SQLite have built in methods for locking the file if they are  
> opened by more
> than one application at the same time, so all transactions are  
> atomic. You
> still have the problem of one instance overwritting the changes of  
> the other
> instances, but you can guarantee that both accessess will happen  
> and will go
> thru without file corruption.
SQLLite with the given standard set of functions is only able to be  
opened from one client. There are some extensions trying to go around  
this, but the common "lock" is a full file lock of the db-file.

So using any extension to go around it and looking at you scenario,  
what happened if you need a "real" transaction? Then there is nothing  
atomic left. Or what happened if an unexpected complex operation took  
several minutes, should all the other users wait?


> What I am to say is that using SQLite you can build a minimal web
> application if you're clever enough to build a locking mechanism to  
> prevent
> overwritting other users changes.
But then you could do the same with V4Rev. Build a file locking  
mechanism (or use on WIndows the system mechanism) for the used db- 
files and use V4Rev. But I didn't know any real world web app that's  
usable with such a mechanism in background.


> Now, since I really like Valentina, can we do something similar  
> with V4REV,
> can more than one application access the same database file without  
> using
> Valentina Server?
If you're talking about a "server" appm then I'm afraid you should  
use a db-server, in this case the VServer. There are several more  
advantages, then only have parallel access for several web-sessions.

IMHO the most important word is CACHE! Using a file based DB solution  
with a file locking scenario the db is loaded again and again for  
every web-request! For most "real" db's this would be ways longer  
then the web-request will need to be executed. So each web-request  
will lock the db for even longer time and even less web-request are  
possible per second.

Using a VServer the requested data is loaded into the cache, given  
you set a propitiate size, and all other reqeust are answered from  
cache, THIS is real speed improvement for a web app. When you now  
start using a db server you can use several more common patterns,  
i.e. store session information inside the db and only handle a id in  
the cookie.


There is only one known exception. When you think of a CMS then you  
can set the Valentina-DB to read only and THEN you can open this db  
with several V4REV sessions at the same time.

HTH,

regards

Thorsten Hohage
--
objectmanufactur.com - Hamburg,Germany





More information about the use-livecode mailing list