0

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.

ella
  • 1
  • 3
  • You're going to need to supply a lot more detail about what you're doing with the events, your configuration etc for anyone to be able to help you – The Archetypal Paul Jan 26 '15 at 13:01

1 Answers1

0

As Paul said, you would need to supply a lot more information. There's a lot of things that could be going on ... CTI's misaligned/misconfigured, unnecessary locking in your source, locking or long-running tasks in your sink ... or any number of other things. I've had StreamInsight process, on average, over 120K events/sec on an i7 laptop ... over a week-long stress test. The engine will handle it.

DevBiker
  • 451
  • 2
  • 4
  • I can send you my project, because I don't know exactly what part of the code to put here in order to find a solution.My laptop configuration is Intel Core i3 with 4 GB RAM. – ella Jan 27 '15 at 06:43
  • I think I found the problem, instead of AdvanceTimeSettings.IncreasingStartTime I had AdvanceTimeSettings.StrictlyIncreasingStartTime. Now the highest value was 8559 events/s. But I am not sure if everything is working ok, because in the Performance Monitor there is a higher value, say 5000 events/s, then it drops to 6 events/s and so on. – ella Jan 28 '15 at 20:50