dougal / acts_as_indexed

Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app
http://douglasfshearer.com/blog/rails-plugin-acts_as_indexed
MIT License
211 stars 49 forks source link

Thread safety and Heroku #8

Closed parndt closed 13 years ago

parndt commented 13 years ago

Does this approach work as well? Looking for zero configuration on Herkou if possible. This is always the area that we get the most "I got an error" reports from when it doesn't "just work"

Thanks! Phil

dougal commented 13 years ago

I added the documentation last night when I saw that running threadsafe had a significant slowdown for the initial building of the index. On Heroku this is an issue because (a) You only have 30s to process a request, and (b) You cannot build the index without making a request.

This morning I re-implemented the atomic-writes, removing most of that performance deficit. See the benchmarks here: https://gist.github.com/b7b182244ad4e11740dc

Single writes now take ~13% longer. Import now takes ~28% longer.

I think I'll remove the threadsafe configuration option, as it just adds confusion for the sake of what is now a very small performance gain.

The fewer configuration options the better.

dougal commented 13 years ago

I removed the configuration. The small slowdown in writes (zero in reads) is 100% worth the locking, and no-configuration is a bonus.

Only just noticed you guys have split Refinery into Engines, that is a nice bit of work!

parndt commented 13 years ago

Nice one, not needing configuration at all is even better :)

Thanks!