Re: Multithreading of [replace]
This WebDNA talk-list message is from 1999
It keeps the original formatting.
numero = 23096
interpreted = N
texte = >Given that I have written a database to do logging of visitors to the website,>so that I can do my own analysis of who did what, I am running into a problem>with the sheer number of write commands being issued to this database>[search db=carts.db&eqCARTdata=[cart]&DATEtype=date&DATEsort=1&DATEsdir=de]>[showif [numfound]=0]>[Append db=carts.db]>cart=[cart]&date=[date]&firstpage=[thisurl]&lastpage=[thisurl]>[/append]>[/showif]>[showif [numfound]=1]>[replace db=carts.db&eqCARTdata=[cart]]>lastpage=[thisurl]>[/replace]>[/showif]>[/search]>So, Grant, here is my question: Is there anything that can be optimized that>will alleviate the speed hit this code causes under load?Multithreading is somewhat slowed here, because carts.db is locked upduring the replace, so no other threads can even read it (other incominghits get 'stuck' at the first search until the replace is done). What OSis this? For multithreading NT would be fastest, MacOS plugin next, andfinally MacOS ACGI. Play with the prefs value of ThreadSwitchTicks; makingit smaller smooths out multithreading but can introduce extra overhead aswell, so it needs tuning.Date searching can be very slow compared to plain text, because WebCatalogmust interpret those dates and calculate lots of stuff. I would re-orderyour date text into YYYY/MM/DD order so that it is text-sortable *without*needing to specify DATEtype=date. I would also set allCase=T so searchesand replaces are case-sensitive (a bit faster).Finally, you can get rid of that whole ShowIf thing: unless I misunderstandyour intention, we already put a feature into replace that will append ifnot found: [replace db=xx&append=T] will append a new record if none isfound.I hope this helps! I think doing all of these things could net you from50% to 500% speed increase.Grant Hulbert, V.P. Engineering | ==== eCommerce for the Rest of Us ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
Associated Messages, from the most recent to the oldest:
>Given that I have written a database to do logging of visitors to the website,>so that I can do my own analysis of who did what, I am running into a problem>with the sheer number of write commands being issued to this database>[search db=carts.db&eqCARTdata=
[cart]&DATEtype=date&DATEsort=1&DATEsdir=de]>[showif [numfound]=0]>[Append db=carts.db]>cart=
[cart]&date=
[date]&firstpage=
[thisurl]&lastpage=
[thisurl]>[/append]>[/showif]>[showif [numfound]=1]>[replace db=carts.db&eqCARTdata=
[cart]]>lastpage=
[thisurl]>[/replace]>[/showif]>[/search]>So, Grant, here is my question: Is there anything that can be optimized that>will alleviate the speed hit this code causes under load?Multithreading is somewhat slowed here, because carts.db is locked upduring the replace, so no other threads can even read it (other incominghits get 'stuck' at the first search until the replace is done). What OSis this? For multithreading NT would be fastest, MacOS plugin next, andfinally MacOS ACGI. Play with the prefs value of ThreadSwitchTicks; makingit smaller smooths out multithreading but can introduce extra overhead aswell, so it needs tuning.Date searching can be very slow compared to plain text, because WebCatalogmust interpret those dates and calculate lots of stuff. I would re-orderyour date text into YYYY/MM/DD order so that it is text-sortable *without*needing to specify DATEtype=date. I would also set allCase=T so searchesand replaces are case-sensitive (a bit faster).Finally, you can get rid of that whole ShowIf thing: unless I misunderstandyour intention, we already put a feature into replace that will append ifnot found: [replace db=xx&append=T] will append a new record if none isfound.I hope this helps! I think doing all of these things could net you from50% to 500% speed increase.Grant Hulbert, V.P. Engineering | ==== eCommerce for the Rest of Us ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
Grant Hulbert
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Math (1997)
Execute Applescript (1997)
question: back button prevention (1997)
Windows-user? (2000)
Caching [include] files ... (1997)
Processing stops (2006)
Running _every_ page through WebCat ? (1997)
[WebDNA] El Capitan with WebDNA 8.1 fastCGI (2015)
Trouble with listwords (2000)
credit card (1997)
triggers.db (1999)
Converting DOS database (2000)
carriage returns in data (1997)
Support ?? (1997)
Multiple Unique SKUs (2000)
Forms Search Questions (1997)
limit to listwords (2001)
WebCat2b13MacPlugIn - syntax to convert date (1997)
Can't ping (problem with [shell]) (2006)
[protect admin] (1997)