Re: Euphoria CGI Success
- Posted by Frank Dowling <frank at frankied.com> Feb 15, 2006
- 537 views
Vincent wrote: >>Have you ever tried to open an EDB file with 50 process >>(no threads on Eu, yet!) simultaneously and write it? I've had no problems with EDS and I've tested it (with apache on my local computer) with heaps of simultaneous write requests and it works fine. Just let only one process write to it at once and have a queing mechanism like mysql or a timeout mechanism. FYI Mysql does not let a record be written to by 50 processes all at once either, but it has a more sophisticated queuing mechanism than EDS. For simple databases like user login, the write request should take no longer than 0.x seconds anyway. A very simplistic way to use EDS for the web would be to fail if it can't get an exclusive lock. A more realistic way would be to wait and keep trying for a bit, and give up and error out after a set period has expired. (this should still work fine for 50 users if you are only updating the record rather than writing copious quanitites of data each hit). A more complicated way would be to employ a database server which queues write requests appropriately like mySQL. I agree with one point that a web library would be needed, not necessarily to standardise but to implement common web things (like hashing passwords) that new web programmers might not know about. > Yes I know Eu is very fast compared to PHP. However that is not what > we need for websites. Moreover, who wants to use PHP for doing sieve? > If sieve were really needed, one could use C and call the sieve > function from Eu or PHP and that will be faster. It depends on what you do with websites. As Rob pointed out PHP would grind to a halt when processing truly massive amounts of data. Mysql is not too flash either all the time. I volunteered innocently to create a website for a regular IRC channel, and was duly delegated the responsibility of programming a page which could draw stats and graphs for *any* period since the channel had begun. How? they gave me the 500 megabytes of logs that had accrued since 1997. Now it's completely possible to do this, ie create dynamic graphs from a web form with this much data - it usually involves indexing the log files into a more binary form and storing it in a database. How long does PHP take to index new log files ? more than 10 times longer than euphoria. And half of that's spent on IO requests anyway which should close the speed difference between the two languages. Now I completed this stats page with PHP and mysql (before I got euphoria working). It takes about 1.4 seconds to render a page for a long period, showing say average daily load between period x and period y for weekdays, weekends, total, etc. Because PHP is so slow for language contructs and loops it was quicker to issue each mysql request seperately and then just dump the data to a graph. Asking mysql to poll the database 3 times was quicker than grabbing * once and selectively parsing it with PHP. With euphoria it's much quicker to pull everything from the database and parse it then and there. I can make the same page in Euphoria render in under half the time I could get it to with PHP mysql. And that's the end of my wee web programming story.