--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hmmm. No hammering. This is a dev integration environment. Indexes get created in every commit, but no changes around the time this happened. What I did which seemed to instigate this was run an update to done app level docs which are tiny. One of them is used in an index via LoadDocument. That index has several let statements which I'm not happy about. I'll save that story for another thread.
Storing a few tiny docs took a few hundred thousand ms, and then I saw the error.
I'm pretty sure I can't repro on demand. Haven't seen it since I restarted.
Running 2330.
Can post index and docs if this is interesting.

Yes. I changed the loaded document so that one document wasn't loaded by all products as we discussed. I also moved index creation out of the app startup pipeline. I created a separate route that only creates the indexes. I redeployed and started the app which worked fine. Then I hit the index creation route and got these response times. That was bad, but not the worse. The worse aspect was that the old index was deleted very quickly. That meant that all pages that use that index got a ysod saying the index did not exist. Effectively, app down.
Well this explains the behavior I was seeing. For the test I was creating 500k documents. In my actual environment I had ~2M docs. Now I have ~6.5M docs (testing the bulk import feature). The web app was timing out the requests. Then I was in a state where the index was deleted but not created again and seeing "index does not exist" errors in the web app. Eventually I was able to submit the create index request and have it return instantly as expected. I assume that was when it was completely done cleaning up.I confirmed that adding an index with LoadDocument is fast even with 500k docs if the index is not already present (v4.cs: https://gist.github.com/kijanawoodard/5638693).Why does LoadDocument slow down index delete so much? Without LoadDocument, replacing the index on 500k docs is sub second.
Giving up LoadDocument leaves me with two unpalatable choices.Originally, I wanted to patch the product document. I can't do that because the system imports the products from third parties and I'm using Bulk Insert. With Bulk Insert, I can overwrite, but not "update". The third parties can send changes to the products at any time and the product doc will be overwritten, losing the patched data.
I could give up Bulk Insert and Load each product while parsing the csv and Store/Update as needed. I figure this will slow down product import dramatically.I could switch to a MultiMap index. The LoadDocument syntax is sooo much more succinct, I'd hate to have to resort to multimap when this is really stitching together two docs with a 1-1 relationship.
So my mind starts to look for other ways.I could do some kind of Blue/Green index scheme where I have ProductIndex1 and ProductIndex2. Whenever I make a change to the index, I make to the one "not in production" and switch all my code to the proper version. This sounds terrible for even a single developer, and awful for a team.My next thought is to give up strongly typed index names and go with a string for index name. Then I can apply ProductIndex2 and then change a config setting to update the index name for queries on product to "ProductIndex2" whenever I feel the index is sufficiently far along.
That's better, but not wonderful.At this point, I'm thinking I could create a document with "Active Index Names" which my queries would use to get the index name string by a key (like "Product Index"). Then in the "create index" code, I would generate an index name by doing something like "new ProductIndex().IndexName + DateTimeOffset.UtcNow.Ticks". When the index was created, I would update my "Active Index" document to use the new index name.If I wanted to get fancy, I could have some kind of "AsOf" timestamp so I could say "start using the new index in one hour". If I wanted to get really really fancy, I could watch the indexing process and update it once it got to the current etag.Now, could some or all of this fit inside RavenDB itself so that, effectively, replacing an index was Add/Delete instead of Delete/Add?p.s.Another piece to the puzzle on LoadDocument. I've noticed that both Bulk Insert and Indexing gets much much slower as more docs are added. With an empty db, I see bulk insert times of 1-2k/second. With ~6 million docs, it takes ~10-20 seconds for a single 512 doc batch.
Line 123: if (!string.IsNullOrWhiteSpace(oldName))
Line 124: {
Line 125: _session.Advanced.DocumentStore.DatabaseCommands.DeleteIndex(oldName);
Line 126: }
Line 127: }[WebException: The remote server returned an error: (500) Internal Server Error.] System.Net.HttpWebRequest.GetResponse() +6442408 Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:332 [InvalidOperationException: Url: "/indexes/ProductIndex" System.InvalidOperationException: Cannot modify indexes while indexing is in progress (already waited full minute). Try again later at Raven.Database.Storage.IndexDefinitionStorage.TryRemoveIndexContext() in c:\Builds\RavenDB-Stable\Raven.Database\Storage\IndexDefinitionStorage.cs:line 271 at Raven.Database.DocumentDatabase.DeleteIndex(String name) in c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs:line 1278 at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs:line 864 at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs:line 609 ] Raven.Client.Connection.HttpJsonRequest.HandleErrors(WebException e) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:475
Calling Load('id-just-bulk-loaded') can result in null. In other words, the server accepts a batch and returns with putting them in the db.
I'd like to check out 2.5 before thinking about this more. Currently I see about 500/s. I noticed with the tests on embedded that it was around 5k/s, but of course that's just memory.