473,466 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

scaling a hand rolled 'SELECT FOR LOCK"

110 New Member
I think this is pretty easy to build, but not sure how well it will scale, and therefore if it will actually work.

I am trying to attach an indexer to a request so that as a search query gets requested, it is more likely to be up to have a deeper data set (easier to see than describe, but it isn't there yet).
In a nutshell, I don't have the resources to go and scour a ton of data, but i've grabbed some starting points, and as the site gets used, those starting points direct what data should be indexed deeper.

What I'm trying to avoid is having 3 people request the same query/data to update at the same time, and have the indexer go and run and update that query's results.
Because they would be rewriting the same data to the same database at the same time.

I don't think the mysql UPDATE FOR LOCK (or something like that) will work because you can still make a request to the locked line, it just can't be updated is my understanding.

the query fields are already populated with unique id's so I can't use mysql_query_id(), as I think that is only for INSERT statements, not UPDATE.

So, what I'm thinking is two mysql calls one after the other.

Expand|Select|Wrap|Line Numbers
  1. $gettingIndex = "SELECT id FROM queries WHERE look_up = '0' LIMIT 0, 1 ; UPDATE queries SET look_up = '1' WHERE id = '0' LIMIT 1;"
  2. mysql_query($gettingIndex);
  3.  
so I think this will work with low traffic but any idea if high traffic will cause it to break?
Unfortunately for me, as traffic increases, I am exponentially increasing the server load, but I may seperate my read and writes to seperate tables, and then schedule to merge the tables on a regular basis.

Anybody ideas of another way of doing this?
May 16 '08 #1
3 1709
dlite922
1,584 Recognized Expert Top Contributor
I'm sorry. But I still don't fully understand what you're trying to achieve. Here's what I grabbed

You have a table full of data. Users make updates. You don't want users to make the same update.

I'm lost at starting point, lock update etc. I understand what MySQL table locking is though.

Please elaborate more on what this system does if you can.

Dan
May 17 '08 #2
pedalpete
110 New Member
sorry it took me so long to respond to this thread again, i was busy trying to get my site launched.

As I said, easier to show than describe.
if you go to [url removed], you can enter a city and it will show you live shows playing near that city.

then I tried describing what I am trying to do here, and it got even more confusing...it needs pictures, so I'll have to sit down with an expert...thanks for trying.
Pete
May 22 '08 #3
dlite922
1,584 Recognized Expert Top Contributor
sorry it took me so long to respond to this thread again, i was busy trying to get my site launched.

As I said, easier to show than describe.
if you go to [url removed], you can enter a city and it will show you live shows playing near that city.

then I tried describing what I am trying to do here, and it got even more confusing...it needs pictures, so I'll have to sit down with an expert...thanks for trying.
Pete

Ok, best of luck to you. I love challenges, when you can tell us what it is you need, we'll figure out a way.

Come back soon,


Dan
May 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Aaron Davies | last post by:
I'm developing a collaborative whiteboard, in which all objects (shapes, clip art icons, etc.) are synchronized between all participants in a session. It's working well, but I'm running into a...
4
by: Scott Johnson | last post by:
Hi I am converting some code from C# to VB.NET and I have come across a command that I can't find the VB equivalent. The C# command is 'lock' and I think it is used to lock a data type from...
1
by: Ron M. Newman | last post by:
Hi. Quick question: - I have a class with fields. There is one method that modifies them. in this method I have something like lock (this.lockObject) { /// throwing exception here... }
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
6
by: Curious | last post by:
I have an arraylist used in three separate methods. In method #1 (event method), some items are removed from the arraylist if certain conditions are met; In method #2 (event method),...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.