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:
WebCatalog books and other resources (2001)
Sami (1998)
Questions To Answer (1997)
Extra equals signs with IE? (More debugging questions...) (1997)
template not found error (1998)
Writing encrypted files causes errors ... (1998)
Problem with [Search] inside of [Loop]? (1997)
Webcatalog error, Plug-in for Webstar (1996)
Calendar (1997)
pdf files? (2001)
Editor (2000)
Sorting a [listdatabases] (2003)
Error, 101 a DNS problem ? (1997)
This list needs a digest: rant, rave... (1997)
One more time (1997)
OT - asp snippet similar to [!][/!] (2003)
Sorry if this is really stupid but.. (2000)
Anyone using Verisign's Payflow Link for payment processing? (2000)
When to use [convertchars] ?!?!? (2000)
Make sure I understand this??? (1997)