Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Lower iterations of tests that consume lot of time

  • Loading branch information...
commit d1fbdb70c440991c026ac94c5c9028ddb7bd21ef 1 parent db2a3c9
@fitzchak fitzchak authored
View
14 Raven.StressTests/Raven.StressTests.csproj
@@ -52,17 +52,17 @@
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
- <Compile Include="MultiThreaded\BatchOperation.cs" />
- <Compile Include="MultiThreaded\MultiThreaded.cs" />
- <Compile Include="MultiThreaded\PutAndBatchOperation.cs" />
- <Compile Include="MultiThreaded\PutOperation.cs" />
+ <Compile Include="Storage\MultiThreaded\BatchOperation.cs" />
+ <Compile Include="Storage\MultiThreaded\MultiThreaded.cs" />
+ <Compile Include="Storage\MultiThreaded\PutAndBatchOperation.cs" />
+ <Compile Include="Storage\MultiThreaded\PutOperation.cs" />
<Compile Include="Races\Tobi.cs" />
<Compile Include="Races\BundelsRaceConditions.cs" />
<Compile Include="Races\RaceConditions.cs" />
- <Compile Include="Storage\MultiThreadedStress\BatchOperationStress.cs" />
- <Compile Include="Storage\MultiThreadedStress\PutOperationStress.cs" />
+ <Compile Include="Storage\MultiThreaded\Stress\BatchOperationStress.cs" />
+ <Compile Include="Storage\MultiThreaded\Stress\PutAndBatchOperationStress.cs" />
+ <Compile Include="Storage\MultiThreaded\Stress\PutOperationStress.cs" />
<Compile Include="StressTest.cs" />
- <Compile Include="Storage\MultiThreadedStress\PutAndBatchOperationStress.cs" />
<Compile Include="Tenants\ConcurrentlyOpenedTenantsUsingEsent.cs" />
</ItemGroup>
<ItemGroup>
View
10 Raven.StressTests/MultiThreaded/BatchOperation.cs → ...ressTests/Storage/MultiThreaded/BatchOperation.cs
@@ -2,11 +2,11 @@
// <copyright file="MultiThreadedStorages.cs" company="Hibernating Rhinos LTD">
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
-// -----------------------------------------------------------------------
-using Raven.Abstractions.Commands;
-using Raven.Json.Linq;
-
-namespace Raven.Tests.Storage.MultiThreaded
+// -----------------------------------------------------------------------
+using Raven.Abstractions.Commands;
+using Raven.Json.Linq;
+
+namespace Raven.StressTests.Storage.MultiThreaded
{
public class BatchOperation : MultiThreaded
{
View
328 Raven.StressTests/MultiThreaded/MultiThreaded.cs → ...tressTests/Storage/MultiThreaded/MultiThreaded.cs
@@ -1,165 +1,165 @@
-// -----------------------------------------------------------------------
-// <copyright file="MultiThreaded.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Concurrent;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using NLog;
-using Raven.Database;
-using Raven.Database.Config;
-using Raven.Database.Extensions;
-using Raven.Database.Impl;
-using Xunit;
-
-namespace Raven.Tests.Storage.MultiThreaded
-{
- public abstract class MultiThreaded : IDisposable
- {
- private readonly Logger log = LogManager.GetCurrentClassLogger();
- protected DocumentDatabase DocumentDatabase;
- private readonly ConcurrentQueue<GetDocumentState> getDocumentsState = new ConcurrentQueue<GetDocumentState>();
-
- private volatile bool run = true;
- private static readonly string DataDirectory = typeof(MultiThreaded).FullName + "-Data";
-
- private Guid lastEtagSeen = Guid.Empty;
- private readonly object Lock = new object();
-
- public void Dispose()
- {
- DocumentDatabase.Dispose();
- lock (Lock)
- {
- IOExtensions.DeleteDirectory(DataDirectory);
- }
- }
-
- protected void SetupDatabaseMunin(bool runInMemory)
- {
- DocumentDatabase = new DocumentDatabase(new RavenConfiguration
- {
- DataDirectory = DataDirectory,
- RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInMemory,
- RunInMemory = runInMemory,
- DefaultStorageTypeName = typeof(Raven.Storage.Managed.TransactionalStorage).AssemblyQualifiedName,
- });
- }
-
- protected void SetupDatabaseEsent(bool runInUnreliableMode)
- {
- DocumentDatabase = new DocumentDatabase(new RavenConfiguration
- {
- DataDirectory = DataDirectory,
- RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInUnreliableMode,
- DefaultStorageTypeName = typeof(Raven.Storage.Esent.TransactionalStorage).AssemblyQualifiedName,
- });
- }
-
- protected void SetupDatabase(DocumentDatabase documentDatabase)
- {
- DocumentDatabase = documentDatabase;
- }
-
- private class GetDocumentState
- {
- private readonly Guid etag;
- private readonly int count;
-
- public Guid Etag
- {
- get { return etag; }
- }
- public int Count
- {
- get { return count; }
- }
-
- public GetDocumentState(Guid etag, int count)
- {
- this.etag = etag;
- this.count = count;
- }
- }
-
- protected void ShouldGetEverything()
- {
- var task = Task.Factory.StartNew(StartGetDocumentOnBackground);
- var count = SetupData();
-
- var final = new Guid("00000000-0000-0100-0000-" + count.ToString("X12"));
- while (lastEtagSeen != final)
- {
- Thread.Sleep(10);
- }
-
- run = false;
- task.Wait();
-
- var states = getDocumentsState.ToArray();
-
- Assert.Equal(final, states.Last().Etag);
- Assert.Equal(count, states.Sum(x => x.Count));
- }
-
- protected abstract int SetupData();
-
- private void StartGetDocumentOnBackground()
- {
- while (run)
- {
- DocumentDatabase.TransactionalStorage.Batch(accessor =>
- {
- var documents = accessor.Documents.GetDocumentsAfter(lastEtagSeen, 128)
- .Where(x => x != null)
- .Select(doc =>
- {
- DocumentRetriever.EnsureIdInMetadata(doc);
- return doc;
- })
- .ToArray();
-
- if (documents.Length == 0)
- return;
-
- lastEtagSeen = documents.Last().Etag.Value;
-
- log.Debug("Docs: {0}", string.Join(", ", documents.Select(x => x.Key)));
-
- getDocumentsState.Enqueue(new GetDocumentState(lastEtagSeen, documents.Length));
- });
- }
- }
-
- [Fact]
- public void WhenUsingEsentOnDisk()
- {
- SetupDatabaseEsent(false);
- ShouldGetEverything();
- }
-
- [Fact]
- public void WhenUsingEsentInUnreliableMode()
- {
- SetupDatabaseEsent(true);
- ShouldGetEverything();
- }
-
- [Fact]
- public void WhenUsingMuninOnDisk()
- {
- SetupDatabaseMunin(false);
- ShouldGetEverything();
- }
-
- [Fact]
- public void WhenUsingMuninInMemory()
- {
- SetupDatabaseMunin(true);
- ShouldGetEverything();
- }
- }
+// -----------------------------------------------------------------------
+// <copyright file="MultiThreaded.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Concurrent;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using NLog;
+using Raven.Database;
+using Raven.Database.Config;
+using Raven.Database.Extensions;
+using Raven.Database.Impl;
+using Xunit;
+
+namespace Raven.StressTests.Storage.MultiThreaded
+{
+ public abstract class MultiThreaded : IDisposable
+ {
+ private readonly Logger log = LogManager.GetCurrentClassLogger();
+ protected DocumentDatabase DocumentDatabase;
+ private readonly ConcurrentQueue<GetDocumentState> getDocumentsState = new ConcurrentQueue<GetDocumentState>();
+
+ private volatile bool run = true;
+ private static readonly string DataDirectory = typeof(MultiThreaded).FullName + "-Data";
+
+ private Guid lastEtagSeen = Guid.Empty;
+ private readonly object Lock = new object();
+
+ public void Dispose()
+ {
+ DocumentDatabase.Dispose();
+ lock (Lock)
+ {
+ IOExtensions.DeleteDirectory(DataDirectory);
+ }
+ }
+
+ protected void SetupDatabaseMunin(bool runInMemory)
+ {
+ DocumentDatabase = new DocumentDatabase(new RavenConfiguration
+ {
+ DataDirectory = DataDirectory,
+ RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInMemory,
+ RunInMemory = runInMemory,
+ DefaultStorageTypeName = typeof(Raven.Storage.Managed.TransactionalStorage).AssemblyQualifiedName,
+ });
+ }
+
+ protected void SetupDatabaseEsent(bool runInUnreliableMode)
+ {
+ DocumentDatabase = new DocumentDatabase(new RavenConfiguration
+ {
+ DataDirectory = DataDirectory,
+ RunInUnreliableYetFastModeThatIsNotSuitableForProduction = runInUnreliableMode,
+ DefaultStorageTypeName = typeof(Raven.Storage.Esent.TransactionalStorage).AssemblyQualifiedName,
+ });
+ }
+
+ protected void SetupDatabase(DocumentDatabase documentDatabase)
+ {
+ DocumentDatabase = documentDatabase;
+ }
+
+ private class GetDocumentState
+ {
+ private readonly Guid etag;
+ private readonly int count;
+
+ public Guid Etag
+ {
+ get { return etag; }
+ }
+ public int Count
+ {
+ get { return count; }
+ }
+
+ public GetDocumentState(Guid etag, int count)
+ {
+ this.etag = etag;
+ this.count = count;
+ }
+ }
+
+ protected void ShouldGetEverything()
+ {
+ var task = Task.Factory.StartNew(StartGetDocumentOnBackground);
+ var count = SetupData();
+
+ var final = new Guid("00000000-0000-0100-0000-" + count.ToString("X12"));
+ while (lastEtagSeen != final)
+ {
+ Thread.Sleep(10);
+ }
+
+ run = false;
+ task.Wait();
+
+ var states = getDocumentsState.ToArray();
+
+ Assert.Equal(final, states.Last().Etag);
+ Assert.Equal(count, states.Sum(x => x.Count));
+ }
+
+ protected abstract int SetupData();
+
+ private void StartGetDocumentOnBackground()
+ {
+ while (run)
+ {
+ DocumentDatabase.TransactionalStorage.Batch(accessor =>
+ {
+ var documents = accessor.Documents.GetDocumentsAfter(lastEtagSeen, 128)
+ .Where(x => x != null)
+ .Select(doc =>
+ {
+ DocumentRetriever.EnsureIdInMetadata(doc);
+ return doc;
+ })
+ .ToArray();
+
+ if (documents.Length == 0)
+ return;
+
+ lastEtagSeen = documents.Last().Etag.Value;
+
+ log.Debug("Docs: {0}", string.Join(", ", documents.Select(x => x.Key)));
+
+ getDocumentsState.Enqueue(new GetDocumentState(lastEtagSeen, documents.Length));
+ });
+ }
+ }
+
+ [Fact]
+ public void WhenUsingEsentOnDisk()
+ {
+ SetupDatabaseEsent(false);
+ ShouldGetEverything();
+ }
+
+ [Fact]
+ public void WhenUsingEsentInUnreliableMode()
+ {
+ SetupDatabaseEsent(true);
+ ShouldGetEverything();
+ }
+
+ [Fact]
+ public void WhenUsingMuninOnDisk()
+ {
+ SetupDatabaseMunin(false);
+ ShouldGetEverything();
+ }
+
+ [Fact]
+ public void WhenUsingMuninInMemory()
+ {
+ SetupDatabaseMunin(true);
+ ShouldGetEverything();
+ }
+ }
}
View
10 ...StressTests/MultiThreaded/PutAndBatchOperation.cs → ...sts/Storage/MultiThreaded/PutAndBatchOperation.cs
@@ -2,11 +2,11 @@
// <copyright file="MultiThreadedStorages.cs" company="Hibernating Rhinos LTD">
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
-// -----------------------------------------------------------------------
-using Raven.Abstractions.Commands;
-using Raven.Json.Linq;
-
-namespace Raven.Tests.Storage.MultiThreaded
+// -----------------------------------------------------------------------
+using Raven.Abstractions.Commands;
+using Raven.Json.Linq;
+
+namespace Raven.StressTests.Storage.MultiThreaded
{
public class PutAndBatchOperation : MultiThreaded
{
View
110 Raven.StressTests/MultiThreaded/PutOperation.cs → ...StressTests/Storage/MultiThreaded/PutOperation.cs
@@ -1,56 +1,56 @@
-// -----------------------------------------------------------------------
-// <copyright file="MultiThreadedStorages.cs" company="Hibernating Rhinos LTD">
-// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
-// </copyright>
-// -----------------------------------------------------------------------
-using Raven.Json.Linq;
-
-namespace Raven.Tests.Storage.MultiThreaded
-{
- public class PutOperation : MultiThreaded
- {
- protected override int SetupData()
- {
- DocumentDatabase.Put("Raven/Hilo/users", null, new RavenJObject(), new RavenJObject(), null);
- DocumentDatabase.Put("Raven/Hilo/posts", null, new RavenJObject(), new RavenJObject(), null);
-
- return 2;
- }
- }
-
- public class MediumPutOperation : PutOperation
- {
- protected override int SetupData()
- {
- for (int i = 1; i <= 10; i++)
- {
- DocumentDatabase.Put("Raven/Hilo/posts" + i, null, new RavenJObject(), new RavenJObject(), null);
-
- for (int j = 1; j <= 6; j++)
- {
- DocumentDatabase.Put(string.Format("posts{0}/{1}", i, j), null, new RavenJObject(), new RavenJObject(), null);
- }
- }
-
- return 10 * 7;
- }
- }
-
- public class BigPutOperation : PutOperation
- {
- protected override int SetupData()
- {
- for (int i = 1; i <= 1000; i++)
- {
- DocumentDatabase.Put("Raven/Hilo/posts" + i, null, new RavenJObject(), new RavenJObject(), null);
-
- for (int j = 1; j <= 49; j++)
- {
- DocumentDatabase.Put(string.Format("posts{0}/{1}", i, j), null, new RavenJObject(), new RavenJObject(), null);
- }
- }
-
- return 1000 * 50;
- }
- }
+// -----------------------------------------------------------------------
+// <copyright file="MultiThreadedStorages.cs" company="Hibernating Rhinos LTD">
+// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
+// </copyright>
+// -----------------------------------------------------------------------
+using Raven.Json.Linq;
+
+namespace Raven.StressTests.Storage.MultiThreaded
+{
+ public class PutOperation : MultiThreaded
+ {
+ protected override int SetupData()
+ {
+ DocumentDatabase.Put("Raven/Hilo/users", null, new RavenJObject(), new RavenJObject(), null);
+ DocumentDatabase.Put("Raven/Hilo/posts", null, new RavenJObject(), new RavenJObject(), null);
+
+ return 2;
+ }
+ }
+
+ public class MediumPutOperation : PutOperation
+ {
+ protected override int SetupData()
+ {
+ for (int i = 1; i <= 10; i++)
+ {
+ DocumentDatabase.Put("Raven/Hilo/posts" + i, null, new RavenJObject(), new RavenJObject(), null);
+
+ for (int j = 1; j <= 6; j++)
+ {
+ DocumentDatabase.Put(string.Format("posts{0}/{1}", i, j), null, new RavenJObject(), new RavenJObject(), null);
+ }
+ }
+
+ return 10 * 7;
+ }
+ }
+
+ public class BigPutOperation : PutOperation
+ {
+ protected override int SetupData()
+ {
+ for (int i = 1; i <= 1000; i++)
+ {
+ DocumentDatabase.Put("Raven/Hilo/posts" + i, null, new RavenJObject(), new RavenJObject(), null);
+
+ for (int j = 1; j <= 49; j++)
+ {
+ DocumentDatabase.Put(string.Format("posts{0}/{1}", i, j), null, new RavenJObject(), new RavenJObject(), null);
+ }
+ }
+
+ return 1000 * 50;
+ }
+ }
}
View
11 ...orage/MultiThreadedStress/BatchOperationStress.cs → ...rage/MultiThreaded/Stress/BatchOperationStress.cs
@@ -3,35 +3,34 @@
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
-using Raven.Tests.Storage.MultiThreaded;
using Xunit;
-namespace Raven.StressTests.Storage.MultiThreadedStress
+namespace Raven.StressTests.Storage.MultiThreaded.Stress
{
public class BatchOperationStress : StressTest
{
[Fact]
public void WhenUsingEsentInUnreliableMode()
{
- Run<BatchOperation>(storages => storages.WhenUsingEsentInUnreliableMode());
+ Run<BatchOperation>(storages => storages.WhenUsingEsentInUnreliableMode(), 10);
}
[Fact]
public void WhenUsingEsentOnDisk()
{
- Run<BatchOperation>(storages => storages.WhenUsingEsentOnDisk());
+ Run<BatchOperation>(storages => storages.WhenUsingEsentOnDisk(), 10);
}
[Fact]
public void WhenUsingMuninInMemory()
{
- Run<BatchOperation>(storages => storages.WhenUsingMuninInMemory());
+ Run<BatchOperation>(storages => storages.WhenUsingMuninInMemory(), 10);
}
[Fact]
public void WhenUsingMuninOnDisk()
{
- Run<BatchOperation>(storages => storages.WhenUsingMuninOnDisk());
+ Run<BatchOperation>(storages => storages.WhenUsingMuninOnDisk(), 10);
}
}
}
View
11 ...MultiThreadedStress/PutAndBatchOperationStress.cs → ...ultiThreaded/Stress/PutAndBatchOperationStress.cs
@@ -3,35 +3,34 @@
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
-using Raven.Tests.Storage.MultiThreaded;
using Xunit;
-namespace Raven.StressTests.Storage.MultiThreadedStress
+namespace Raven.StressTests.Storage.MultiThreaded.Stress
{
public class PutAndBatchOperationStress : StressTest
{
[Fact]
public void WhenUsingEsentInUnreliableMode()
{
- Run<PutAndBatchOperation>(storages => storages.WhenUsingEsentInUnreliableMode());
+ Run<PutAndBatchOperation>(storages => storages.WhenUsingEsentInUnreliableMode(), 100);
}
[Fact]
public void WhenUsingEsentOnDisk()
{
- Run<PutAndBatchOperation>(storages => storages.WhenUsingEsentOnDisk());
+ Run<PutAndBatchOperation>(storages => storages.WhenUsingEsentOnDisk(), 100);
}
[Fact]
public void WhenUsingMuninInMemory()
{
- Run<PutAndBatchOperation>(storages => storages.WhenUsingMuninInMemory());
+ Run<PutAndBatchOperation>(storages => storages.WhenUsingMuninInMemory(), 300);
}
[Fact]
public void WhenUsingMuninOnDisk()
{
- Run<PutAndBatchOperation>(storages => storages.WhenUsingMuninOnDisk());
+ Run<PutAndBatchOperation>(storages => storages.WhenUsingMuninOnDisk(), 300);
}
}
}
View
22 ...Storage/MultiThreadedStress/PutOperationStress.cs → ...torage/MultiThreaded/Stress/PutOperationStress.cs
@@ -3,40 +3,40 @@
// Copyright (c) Hibernating Rhinos LTD. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
-using Raven.Tests.Storage.MultiThreaded;
using Xunit;
-namespace Raven.StressTests.Storage.MultiThreadedStress
+namespace Raven.StressTests.Storage.MultiThreaded.Stress
{
public class PutOperationStress : StressTest
{
[Fact]
public void WhenUsingEsentInUnreliableMode()
{
- Run<PutOperation>(storages => storages.WhenUsingEsentInUnreliableMode());
+ Run<PutOperation>(storages => storages.WhenUsingEsentInUnreliableMode(), 100);
}
[Fact]
public void WhenUsingEsentOnDisk()
{
- Run<PutOperation>(storages => storages.WhenUsingEsentOnDisk());
+ Run<PutOperation>(storages => storages.WhenUsingEsentOnDisk(), 50);
}
[Fact]
public void WhenUsingMuninInMemory()
{
- Run<PutOperation>(storages => storages.WhenUsingMuninInMemory());
+ Run<PutOperation>(storages => storages.WhenUsingMuninInMemory(), 200);
}
[Fact]
public void WhenUsingMuninOnDisk()
{
- Run<PutOperation>(storages => storages.WhenUsingMuninOnDisk());
+ Run<PutOperation>(storages => storages.WhenUsingMuninOnDisk(), 200);
}
}
public class BigPutOperationStress : StressTest
{
+ // TODO: increase iterations to 10.
private const int Iterations = 1;
[Fact]
@@ -66,30 +66,28 @@ public void WhenUsingMuninOnDisk()
public class MediumPutOperationStress : StressTest
{
- private const int Iterations = 1000;
-
[Fact]
public void WhenUsingEsentInUnreliableMode()
{
- Run<MediumPutOperation>(storages => storages.WhenUsingEsentInUnreliableMode(), Iterations);
+ Run<MediumPutOperation>(storages => storages.WhenUsingEsentInUnreliableMode(), 10);
}
[Fact]
public void WhenUsingEsentOnDisk()
{
- Run<MediumPutOperation>(storages => storages.WhenUsingEsentOnDisk(), Iterations);
+ Run<MediumPutOperation>(storages => storages.WhenUsingEsentOnDisk(), 10);
}
[Fact]
public void WhenUsingMuninInMemory()
{
- Run<MediumPutOperation>(storages => storages.WhenUsingMuninInMemory(), Iterations);
+ Run<MediumPutOperation>(storages => storages.WhenUsingMuninInMemory(), 10);
}
[Fact]
public void WhenUsingMuninOnDisk()
{
- Run<MediumPutOperation>(storages => storages.WhenUsingMuninOnDisk(), Iterations);
+ Run<MediumPutOperation>(storages => storages.WhenUsingMuninOnDisk(), 10);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.