Bloomberg APIv3 returns slow consumer alerts

I made a program in C # based on the SubscriptionWithEventHandlerExample API 3.2.9.0 example. After subscribing to about 500 securities for real-time data, I get ADMIN event alerts that require SlowConsumerWarning and SlowConsumerWarningCleared . I read somewhere that it introduces some delay until I handle all the events.

The problem is that in my code I only get callbacks from bloomberg. The event queue is not even included in my program!

Some things I tried:

  • will increase the queue limit by setting MaxEventQueueSize in the session parameters (it seems to have no effect)

  • see if any timeout event succeeds (no, I don't get it)

  • create several sessions and subscribe to 50 securities in each (now I get several alerts, one for each stream)

Is there something I can do, or is this behavior beyond my capabilities?

+4
source share
3 answers

You can process data in a dedicated stream and only allow Bloomberg callbacks to place data in the queue. Your data stream will read data from the queue and do any laborious work. This may solve your problem, depending on what causes SlowConsumerWarning . If your data processing code is too slow, your queue will fill up over time.

+4
source

The Bloomberg API and related processes are internally multithreaded. If you subscribe to a source in real time and do not process events fast enough so that events internally trigger backups in the Bloomberg API, the API will issue a warning about a slow consumer. I think that at this stage he can also start throttling or dropping events. Are you doing something time-consuming in the event callback (writing to the database)?

The bottom line is that if you subscribe to real-time data for 500 securities events, your event processing should keep up with the flow of data you are subscribed to.

+3
source

I'm not sure if it applies to the above problem, but most likely shed light on the possibility.

If you make a request for data that leads to a large number of events generated by the Bloomberg API (for example, a long historical intraday data request or possibly real-time subscription), do not use the template specified in the API documentation, as it may end up make your application very slow to receive all events. Basically, do not call NextEvent () on the Session object, use the highlighted EventQueue instead.

Instead of this:

 var cID = new CorrelationID(1); session.SendRequest(request, cID); do { Event eventObj = session.NextEvent(); ... } 

Do it:

 var cID = new CorrelationID(1); var eventQueue = new EventQueue(); session.SendRequest(request, eventQueue, cID); do { Event eventObj = eventQueue.NextEvent(); ... } 

This can lead to some performance improvements, although it is known that the API is not particularly deterministic ...

+1
source

Source: https://habr.com/ru/post/1306385/


All Articles