I don't know why my StreamInsight engine cannot handle more than 140 events/s, in the conditions that above 8000 events are delivered per second. I am seeing the number of events/s for my query in the Performance Monitor. And in the console of the application is like the engine avoids lots of events. I have an event with id: 200 then the next one with id: 3330. Does someone know what the problem can be?
For my testing I have a chain of queries. The output of the first query is the input of the second one and so on and for this scenario the result is not more than 140 events/s.
Now I tested my application with a simple query, which outputs all events received from the input stream, and in this situation the server handles approximately 2000 events/s. I have some images with the results, but unfortunately I cannot put them yet. What bothers me is why the amount of events/s decreased suddenly to 0 and why the engine still does not take into consideration all input events.
Here are my server configuration and the query I am using.
using (var server = Server.Create("SIInstance23"))
{
log.Info("StreamInsight Server started");
Application application = server.CreateApplication("StreamInsight Application Test");
ServiceHost host = new ServiceHost(server.CreateManagementService());
WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message);
binding.HostNameComparisonMode = HostNameComparisonMode.Exact;
host.AddServiceEndpoint(typeof(IManagementService),
binding,
"http://localhost:8081/StreamInsight/SIInstance23");
ScenarioWorkflow.NormalScenarioWorkflow(application, server, host);
}
public static void NormalScenarioWorkflow(this Application application, Server server, ServiceHost host)
{
host.Open();
IQStreamable<SensorDataEvent> inputStream = application.DefineSensorDataEventStream();
var simpleQuery = from e in inputStream
select e;
var simpleQueryConsumer = application.DefineConsumer(simpleQuery);
var simpleQueryBinding = simpleQuery.Bind(simpleQueryConsumer);
using (simpleQueryBinding.Run("process"))
{
Thread.Sleep(1000);
Console.WriteLine(string.Empty);
DiagnosticSettings settings = server.GetDiagnosticSettings(new Uri("cep:/Server/Application/StreamInsight Application Test/Entity/process/Query/StreamableBinding_1"));
settings.Aspects |= DiagnosticAspect.PerformanceCounters;
server.SetDiagnosticSettings(new Uri("cep:/Server/Application/StreamInsight Application Test/Entity/process/Query/StreamableBinding_1"), settings);
Console.WriteLine("***Hit Return to exit after viewing query output***");
Console.WriteLine();
Console.ReadLine();
}
host.Close();
}
Next, when I tried to run my last query(from the chain), I got approximately 1500 events/s. Still there is the problem with the sudden decrease of events/s. I thought that each transformation made to an event produces a new one which needs to be handled by the engine. So, the number of events/s from a chain of queries should me more than 1500. Please correct me if I am wrong. I am new to this domain and any advice is welcome.
I think the problem is in the class below.
I tried also with PointEvent<SendorDataEvent>
instead of SensorDataEvent
, and tried to insert the CTI as well but no results.
public class SocketEventInputAdapter : IObservable<SensorDataEvent>, IDisposable
{
public List<IObserver<SensorDataEvent>> observers { get; set; }
public object sync { get; set; }
public bool done { get; set; }
public SocketEventInputAdapter()
{
this.done = false;
this.observers = new List<IObserver<SensorDataEvent>>();
this.sync = new object();
SocketServer serverSocket = new SocketServer(4444, this);
}
internal void NotifyObservers(SensorDataEvent value)
{
lock (sync)
{
if (!done)
{
foreach (var observer in observers)
{
observer.OnNext(value);
}
}
}
}
public IDisposable Subscribe(IObserver<SensorDataEvent> observer)
{
lock (sync)
{
observers.Add(observer);
}
return new Subscription(this, observer);
}
void IDisposable.Dispose()
{
}
private sealed class Subscription : IDisposable
{
private readonly SocketEventInputAdapter _subject;
private IObserver<SensorDataEvent> _observer;
public Subscription(SocketEventInputAdapter subject, IObserver<SensorDataEvent> observer)
{
_subject = subject;
_observer = observer;
}
public void Dispose()
{
IObserver<SensorDataEvent> observer = _observer;
if (null != observer)
{
lock (_subject.sync)
{
_subject.observers.Remove(observer);
}
_observer = null;
}
}
}
}
Thank you.