Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slow multi-user response
Message
From
14/07/1997 14:12:31
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Slow multi-user response
Miscellaneous
Thread ID:
00039866
Message ID:
00039866
Views:
92
User A adds a new record to a shared table

User B, on a different machine, (or in our test case in another copy of Visual FoxPro running on the same machine) is watching the same table looking for a record with specific content. Fortunately we have an appropriate index. Unfortunately, it is taking from 2 to 5 seconds for user B to find the new record from the time that user A does his replace. What's going on?

User B's code looks something like this

use Food shared in 0
set order to Vegetable
do while .t.
if seek("Turnip")
? "We found it at ", seconds()
exit
endif
enddo

User A tried to speed things up by puting a FLUSH command after the REPLACE, but it didn't help.

Things did speed up though to almost instantaneous response when user B changed his code to:

use Food shared in 0
set order 0 && We won't bother with the index

do while .t.
go top
do while !(Food.Vegetable == "Turnip") and !eof()
skip
enddo

if Food.Vegetable == "Turnip"
? "We found it at ", seconds()
exit
endif
enddo


This brute force method that could end up doing hundreds (or thousands) of skips beats the seek approach hands down. Its as if the table update is seen immediately by both processes, but the index update comes 2 to 5 seconds later. Sure, this is a complicated index, ... but 2 to 5 seconds?

Bob
Next
Reply
Map
View

Click here to load this message in the networking platform