optimistic

Optimistic vs. Pessimistic locking

I understand the differences between optimistic and pessimistic locking*. Now could someone explain to me when I would use either one in general? And does the answer to this question change depending on whether or not I'm using a stored procedure to perform the query? *But just to check, optimistic means "don't lock the table while re...

Business application - pessimistic concurrency using messaging

We are using messaging in a project of ours to implement pessimistic concurrency. This means that if messaging goes down (channel goes down), concurrency goes down. Is this done in other business applications? Do you close the application (log out the user) if messaging goes down? I'm thinking more of combining the optimistic and p...

Improving worldwide website performance without using a CDN?

CDNs seem like a tremendously brute-force approach to improving website performance across the world, since they use some thousands of machines close to the end-user to ensure good throughput. Are there any ways of improving performance over long distances with high latency or slow-ish links (e.g., UK to Australia) over the "usual" meth...

Under what circumstances will Active Record fail to enforce optimistic locking?

I watched in horror this morning as a script, running on two different machines, happily loaded, updated, and saved. I'm running ruby 1.8.6, AR 2.2.2. I started playing with some test cases and found reduced it to a minimal reproduction case: irb(main):059:0> first = Job.find :first => #<Job id: 323, lock: 8, worker_host: "second"> i...

Why does activerecord optimistic locking work only once per row?

Somehow, I always get these on Fridays. My earlier question was regarding the same problem, but I can now narrow things down a bit: I've been playing with this all day, trying to make sense of it. I have a table with a lock_version colum, specified thus: add_column :jobs, :lock_version, :integer, :default=>0 And I do something like...

Optimistic concurrency in ADO.NET Entity Framework

I found an MSDN article that describes how EF handles concurrency when saving changes: By default [...] Object Services saves object changes to the database without checking for concurrency. For properties that might experience a high degree of concurrency, we recommend that the entity property be defined in the conceptua...

fluent nhibernate automap version column

Current code in my convention: public void Apply(FluentNHibernate.Conventions.Instances.IVersionInstance instance) { instance.Column("RowVersion"); instance.Not.Nullable(); instance.UnsavedValue("0"); instance.Default(1); } This doesn't render the RowVersion as a version column. It treats Ro...

how to catch OptimisticLockException in web layer

I'm having one issue that is how to catch OptimisticLockException in web layer (.war code) when it is raised by the EJB layer. We are using JEE5, GlassFishV2.1 and JPA (with TopLinks)and Container Managed Transactions.But when the dirty read occur due to trnasaction by another concurrent user on the same entity.It gives Transaction.Roll...