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 up during the replace, so no other threads can even read it (other incoming hits get 'stuck' at the first search until the replace is done). What OS is this? For multithreading NT would be fastest, MacOS plugin next, and finally MacOS ACGI. Play with the prefs value of ThreadSwitchTicks; making it smaller smooths out multithreading but can introduce extra overhead as well, so it needs tuning.Date searching can be very slow compared to plain text, because WebCatalog must interpret those dates and calculate lots of stuff. I would re-order your 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 searches and replaces are case-sensitive (a bit faster).Finally, you can get rid of that whole ShowIf thing: unless I misunderstand your intention, we already put a feature into replace that will append if not found: [replace db=xx&append=T] will append a new record if none is found.I hope this helps! I think doing all of these things could net you from 50% 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 | Typhoon 619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Multithreading of [replace] (Kenneth Grome 1999)
  2. Re: Multithreading of [replace] (Christer Olsson 1999)
  3. Re: Multithreading of [replace] (Kenneth Grome 1999)
  4. Re: Multithreading of [replace] (Brian B. Burton 1999)
  5. Re: Multithreading of [replace] (Grant Hulbert 1999)
  6. RE: Multithreading of [replace] (Olin Lagon 1999)
  7. Re: Multithreading of [replace] (Brian B. Burton 1999)
  8. RE: Multithreading of [replace] (Olin Lagon 1999)
  9. Multithreading of [replace] (Brian B. Burton 1999)
>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 up during the replace, so no other threads can even read it (other incoming hits get 'stuck' at the first search until the replace is done). What OS is this? For multithreading NT would be fastest, MacOS plugin next, and finally MacOS ACGI. Play with the prefs value of ThreadSwitchTicks; making it smaller smooths out multithreading but can introduce extra overhead as well, so it needs tuning.Date searching can be very slow compared to plain text, because WebCatalog must interpret those dates and calculate lots of stuff. I would re-order your 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 searches and replaces are case-sensitive (a bit faster).Finally, you can get rid of that whole ShowIf thing: unless I misunderstand your intention, we already put a feature into replace that will append if not found: [replace db=xx&append=T] will append a new record if none is found.I hope this helps! I think doing all of these things could net you from 50% 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 | Typhoon 619/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)