Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not clear what these properties do #77

Open
dariusdev opened this issue Feb 26, 2021 · 1 comment
Open

Not clear what these properties do #77

dariusdev opened this issue Feb 26, 2021 · 1 comment

Comments

@dariusdev
Copy link

dariusdev commented Feb 26, 2021

Can someone explain what these properties do?

<BulkSize>2000</BulkSize> <BulkIdleTimeout>10000</BulkIdleTimeout> <IndexAsync>False</IndexAsync> <DropEventsOverBulkLimit>False</DropEventsOverBulkLimit>

@urielha
Copy link
Owner

urielha commented Mar 17, 2021

Sure,

Bulk properties

The indexing to Elasticsearch are sent by bulk and not one by one.
So on each call to "log" it will be accumulated until we have enough messages to sent or until a timeout is reached.

BulkSize

Number of messages to save in the memory before sending to Elasticsearch.

Possible values:

  • Any number that is greater than 1 - normal behavior as described
  • 1 - Don't accumulate and just send each message
  • 0 - Rely only on timeout. Accumulate all messages until timeout is reached regardless the current number of messages.

BulkIdleTimeout

As described, once this timeout (in milliseconds) is reached the current messages that are waiting in the bulk will be sent to elastic even if BulkSize isn't reached.

This action happens at a different thread than your code.

DropEventsOverBulkLimit

Sometimes users are ok with loosing some log messages in favor of memory and I/O.
You can set this property to True in order to:

  • Send messages to Elastic only when timeout is reached
  • If a new message arrive and we already have BulkSize messages waiting - the message will be dropped and lost.
    A warning message will be written to the log4net ErrorHandler (LogLog)

IndexAsync

Whether to send the requests to Elasticsearch in an async manner.
Technically it will use .net async/await for this.

If sets to True each http request won't block your code and will call an async function that will send the request in different task.

If sets to False each http request will block your code which called the log function until it's done.

Pay attention that if BulkSize is greater than 1, not all calls to "log" will be blocked but only the last one that caused the bulk size to reach it's maximum size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants