Hi all,<br><br>Excuse me if it's a silly question (I'm a newbie here), but what about using a search engine component instead of SQL queries ?<br>I think about Apache Lucene (Java search engine) for example (<a href="http://lucene.apache.org/">http://lucene.apache.org/</a>) which seems to me a better solution about indexing and searching than SQL requests ?<br>
<br>Nico<br><br><div class="gmail_quote">On Mon, Jan 12, 2009 at 2:05 PM, Tom Hughes <span dir="ltr"><<a href="mailto:tom@compton.nu">tom@compton.nu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">David Earl wrote:<br>
<br>
> While what Tom says may help performance, I don't think it is why things<br>
> are running disparately slowly at the moment.<br>
<br>
</div>Oh yes it is...<br>
<div class="Ih2E3d"><br>
> It is mainly extremely slow at present because it has got into a state<br>
> where daily updates are interfering with each other and I haven't had a<br>
> chance to look at why this is happening. It is getting worse, because<br>
> each day slows down more so the next day starts up and interferes with<br>
> that. I know it needs attention. While the updates are running, searches<br>
> are much slower because they don't get much opportunity to run. I<br>
> suspect his vicious circle started because there was one day when there<br>
> was an exceptionally large update and this ran fro > 24 hours, running<br>
> into the next.<br>
<br>
</div>How many times do I have to explain the problem... The problem is lock<br>
contention because you're using MyISAM tables.<br>
<br>
Here is what happens:<br>
<br>
   - You start update and it runs quite happily initially<br>
<br>
   - User issues query which, for whatever reason, takes a long<br>
     times (many minutes or even hours) to run, which leads to a<br>
     read lock on the main tables<br>
<br>
   - Update blocks waiting for a write lock<br>
<br>
   - All other queries now block behind the writer as they can't<br>
     get a read lock until it is done<br>
<br>
   - Several hours later the update is still blocked, all the Apache<br>
     processes are wedged with pending queries and the whole thing<br>
     is buggered<br>
<br>
   - Eventually the slow query finishes and the update happens, then<br>
     hundreds of pending queries all kick off and content with each<br>
     other so run really slowly<br>
<br>
   - The next update is now blocked behind all those readers<br>
<br>
   - The above repeats ad infinitum and nobody gets anything much done<br>
<br>
If it's really bad then, as you've noticed, one day's update won't<br>
finish before the next one is due to start.<br>
<br>
It is really very simple - MyISAM tables are not suitable for any case<br>
where you will have contention between readers and writers, especially<br>
if some of the read queries may be long running.<br>
<div class="Ih2E3d"><br>
Tom<br>
<br>
--<br>
Tom Hughes (<a href="mailto:tom@compton.nu">tom@compton.nu</a>)<br>
<a href="http://www.compton.nu/" target="_blank">http://www.compton.nu/</a><br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="Wj3C7c">dev mailing list<br>
<a href="mailto:dev@openstreetmap.org">dev@openstreetmap.org</a><br>
<a href="http://lists.openstreetmap.org/listinfo/dev" target="_blank">http://lists.openstreetmap.org/listinfo/dev</a><br>
</div></div></blockquote></div><br>