Git Product home page Git Product logo

Comments (10)

komamitsu avatar komamitsu commented on August 20, 2024

@gjobin Sorry for my late reply.
You can create a Fluency instance that synchronously flushes data like this

// Same as: TCPSender sender = new TCPSender.Config().setHost("localhost").setPort(24224).createInstance();
TCPSender sender = new TCPSender.Config().createInstance();
Fluency fluency = new Fluency.Builder(sender).setFlusherConfig(new SyncFlusher.Config()).build();

I'll add an example code snippet like the above to README later. Maybe I should add a configuration API to Fluency.defaultFluency() for AsyncFlusher.

from fluency.

gjobin avatar gjobin commented on August 20, 2024

Thank you for the reply.
Sure A configuration API would do the job, but at least I can now do it manually.

from fluency.

jklap avatar jklap commented on August 20, 2024

I've been testing sync flushing and see some weird behavior that I can't explain looking at the code.

I've configured Fluency as above-- no other options. I've then set up a thread that pushes ~200 small messages into emit() per minute every minute. But fluentd isn't receiving them in a timely manner. I added a file output to fluentd and I've been watching it for 30 minutes now with no data. Is this expected?

from fluency.

komamitsu avatar komamitsu commented on August 20, 2024

@jklap With SyncFlusher, Fluency doesn't flush its buffers automatically. Can you call Fluency#flush when you want to flush the buffers?

from fluency.

komamitsu avatar komamitsu commented on August 20, 2024

I'm closing this issue. The issue @jklap said above is being discussed on #64.

from fluency.

jklap avatar jklap commented on August 20, 2024

That is curious-- both emit() and Fluency#flush() call flushInternal() which calls buffer.flush() depending on the flag force or time passed or buffer threshold-- so am I reading this wrong as it does seem like SyncFlusher should flush during calls to emit()? And I'm not calling Fluency#flush() but it is flushing-- anywhere between 45 and 90 minutes consistently with that number of messages.

from fluency.

komamitsu avatar komamitsu commented on August 20, 2024

Fluency flushes the buffers when it tried to append an event to the buffers and runs into BufferFullException. https://github.com/komamitsu/fluency/blob/master/src/main/java/org/komamitsu/fluency/Fluency.java#L163

You kept to append events calling emit() without a call of flush() and the Fluency caught BufferFullException. As a result, the Fluency flushed the buffers the several ten minutes later, I think.

from fluency.

jklap avatar jklap commented on August 20, 2024

Wouldn't the flushInternal() called as part of the emit() force a flush based on time or threshold? Or am misunderstanding that logic?

from fluency.

jklap avatar jklap commented on August 20, 2024

emit(), upon catching the BufferFullException logs that fact at an error level before calling flush()-- I don't see that error message in my log files. But even so, both emit() and flush() end up calling flushInternal() which should trigger not only on the forced flag but also on time or threshold, yes?

from fluency.

komamitsu avatar komamitsu commented on August 20, 2024

Oops. Sorry, it looks like I missed another path. Let me check...

from fluency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.