disruptor | My take on the LMAX Disruptor
kandi X-RAY | disruptor Summary
kandi X-RAY | disruptor Summary
My take on the LMAX Disruptor, with a different API. Existing C implementations of the LMAX disruptor relied on virtual interfaces and dispatch methods that copied from Java. This implementation attempts to do things in a more C way and provide what I hope to be a simpler interface.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of disruptor
disruptor Key Features
disruptor Examples and Code Snippets
Community Discussions
Trending Discussions on disruptor
QUESTION
I am trying to analyze and implement mixed sync and async logging. I am using Spring boot application along with disruptor API. My log4j configuration:
...ANSWER
Answered 2021-Apr-27 at 07:41I'm not really sure what you think you are testing.
When additivity is enabled the log event will be copied and placed into the Disruptor's Ring Buffer where it will be routed to the console appender on a different thread. After placing the copied event in the buffer the event will be passed to the root logger and routed to the Console Appender in the same thread. Since both the async Logger and sync Logger are doing the same thing they are going to take approximately the same time. So I am not really sure why you believe anything will be left around by the time the System.out call is made.
When you only use the async logger the main thread isn't doing anything but placing events in the queue, so it will respond much more quickly and it would be quite likely your System.out message would appear before all log events have been written.
I suspect there is one very important piece of information you are overlooking. When an event is routed to a Logger the level specified on the LoggerConfig the Logger is associated with is checked. When additivity is true the event is not routed to a parent Logger (there isn't one). It is routed to the LoggerConfig's parent LoggerConfig. A LoggerConfig calls isFiltered(event) which ONLY checks Filters that have been configured on the LoggerConfig. So even though you have level="info" on your Root logger, debug events sent to it via the AsyncLogger will still be logged. You would have to add a ThresholdFilter to the RootLogger to prevent that.
QUESTION
Recently, when I write data into elasticsearch with BulkRequest, I got the following exception:
...ANSWER
Answered 2021-Mar-10 at 05:01ES _id field doesn't support blank char like "".
You have 2 options:
Always provide an id
You just need to remove the id field that you have and elastic will assign an auto-generated one in "_id" field. Something like
QUESTION
I have added a field to metadata for transferring and persisting in the status index. The field is a List of String and its name is input_keywords. After running topology in the Strom cluster, The topology halted with the following logs:
...ANSWER
Answered 2021-Mar-01 at 10:25You are modifying a Metadata instance while it is being serialized. You can't do that, see Storm troubleshooting page.
As explained in the release notes of 1.16, you can lock the metadata. This won't fix the issue but will tell you where in your code you are writing into the metadata.
QUESTION
we're migrating domains and some but not all content. The URL structure is different.
Below is what I have in my .htaccess file. I only added the code at the end starting with "#User added 301 Redirect", the other entries were in .htaccess already.
Expected/Desired: I want anyone who goes to the old main domain to the new main domain, and anyone who attempts to access these specific pages of the old site/domain to go to the mapping in the new site.
Observed: the main domain 301 works olddomain.com now goes to newdomain.com, or if the file name/path is exactly the same. Redirects follow he taxonomy of the old domain, not use my mapping. So, "olddomain.com/about-me" tries to go to "newdomain.com/about-me" instead of the correct mapping "newdomain.com/about" as shown in the .htaccess file and results in a 401 file not found error.
Thoughts? Feel free to respond like I'm five years old.
...ANSWER
Answered 2021-Feb-28 at 17:27You could try redirect directives in following order:
QUESTION
We want to centralize all our java application logs on Graylog server. We use apache tomcat as a container and log4j for the logging framework. log4j2.xml
...ANSWER
Answered 2021-Jan-27 at 15:13Finally solved. According to documentation
GELF TCP does not support compression due to the use of the null byte (\0) as frame delimiter.
So after disabling compress on the log4j2
configuration we saw our log on the gray log server. The below code snippet is a working example
QUESTION
I am running Apache Ignite .Net in a Kubernetes cluster on Linux nodes.
Recently I updated my ignite 2.8.1 cluster to v2.9. After the update some of the services being parts of the cluster fail to start up with the following message:
*** stack smashing detected ***: terminated
Interestingly, most often it happens with the 2nd instances of the same microservice. The first instances usually start up successfully (but sometimes the first instances fail, too). Another observation is that it happens to the nodes which publish Service Grid services. Sometimes a full cluster recycle (killing all the nodes then spinning them up again) helps to get all the nodes to start up, sometimes not.
Did I mess up something during the update? What should I check first of all?
Below is an excerpt from the Ignite log.
...ANSWER
Answered 2020-Dec-10 at 15:14stack smashing detected
usually indicates a NullReferenceException
in C# code.
Set COMPlus_EnableAlternateStackCheck
environment variable to 1
before running your app to see full stack trace (this works for .NET Core 3.0 and later).
QUESTION
I recently discovered that
setting a Target-specific Variable
using a conditional assignment (?=
)
has the effect of unexporting the global variable using the same name.
For example:
target: CFLAGS ?= -O2
If this statement is anywhere in the Makefile, it has the same impact as unexport CFLAGS
for the global variable.
It means that the CFLAGS
passed as environment variable to the Makefile
will not be passed as environment variable to any sub-makefile, as if it was never set.
Could it be a make
bug ?
I couldn't find any mention of this side effect in the documentation.
Example : root Makefile
ANSWER
Answered 2020-Dec-01 at 04:33I reproduce your observed behavior with GNU make
4.0. I concur with your characterization that the effect seems to be as if the variable in question had been unexport
ed, and I confirm that the same effect is observed with other variable names, including names that are without any special significance to make
.
This effect is undocumented as far as I can tell, and unexpected. It seems to conflict with the manual, in that the manual describes target-specific variable values as causing a separate instance of the affected variable to be created, so as to avoid affecting the global one, yet we do see the global one being affected.
Could it be a
make
bug ?
It indeed does look like a bug to me. Evidently to other people, too, as it appears that the issue has already been reported.
QUESTION
I am going through Asynchronous logging in different loggers. I happened to see log4j2's async logger in detail. It is using LMAX Disruptor internally to store events. Why are they using LMAX Disruptor instead of any built-in non-blocking data structure of java?
...ANSWER
Answered 2020-Sep-12 at 12:19Async Loggers, based on the LMAX Disruptor, were introduced in Log4j 2.0-beta-5 in April 2013. Log4j2 at the time required Java 6. The only built-in non-blocking datastructure that I am aware of in Java 6 is ConcurrentLinkedQueue
.
Why the Disruptor? Reading the LMAX Disruptor white paper, I learned that queues are generally not optimal data structure for high-performance inter-thread communication, because there is always contention on the head or the tail of the queue.
LMAX created a better design, and found in their performance tests that the LMAX Disruptor vastly outperformed ArrayBlockingQueue
. They did not test ConcurrentLinkedQueue
because it is unbounded and would blow up the producer (out of memory error) in scenarios where there is a slow consumer (which is quite common).
I don't have data from my own tests at the time, but I remember that ConcurrentLinkedQueue
was better than ArrayBlockingQueue
, something like 2x higher throughput (my memory of the exact numbers is vague). So LMAX Disruptor was still significantly faster, and there was much less variance around the results. ConcurrentLinkedQueue
sometimes had worse results than ArrayBlockingQueue
, quite strange.
LMAX Disruptor performance was stable, much faster than other components, and it was bounded, so we would not run out of memory if an application would use a slow consumer like logging to a database or the console.
As the Async Loggers performance page, and the overall Log4j2 performance page shows, the use of LMAX Disruptor put Log4j2 miles ahead of competing offerings in terms of performance, certainly at the time when Log4j2 was first released.
QUESTION
EDIT: Although yukim's workaround does work, I found that by downgrading to JDK 8u251 vs 8u261, the sigar lib works correctly.
- Windows 10 x64 Pro
- Cassandra 3.11.7
NOTE: I have JDK 11.0.7 as my main JDK, so I override JAVA_HOME and PATH in the batch file for Cassandra.
Opened admin prompt and...
java -version
...ANSWER
Answered 2020-Jul-29 at 01:05I think it is sigar-lib that cassandra uses that is causing the problem (especially on the recent JDK8).
It is not necessary to run cassandra, so you can comment out this line from cassandra-env.ps1 in conf directory: https://github.com/apache/cassandra/blob/cassandra-3.11.7/conf/cassandra-env.ps1#L357
QUESTION
I know there is a number of questions on this platform similar to this one but so far no solution has solved my problem.
The project was working just fine until I decided to modularize it, my folder structure looks like this
Accounting - Parent
-> banking - Child
-> Commons - Child
-> Reports - Child
-> humaResourceManagement - Child
-> payRoll - Child
-> sales - Child
After creating the modules I noticed all the sudden my app could not locate application.properties
in my parent project, the child projects as of now do not have .properties
so I know very well it is not a clash, before this was working I did not even need to @PropertySource
annotations, it just worked but now it does not, for it to work I need to specify the properties like
ANSWER
Answered 2020-Jun-05 at 22:40In case of 'jar' packaging, by default JAR Plugin looks for 'src/main/resources' directory for the resources and bundled them along with code build (if not configured for custom resource directory etc).
But 'pom' packaging doesn't work this way so application.properties is not included in build if it is not specified with some annotation etc.
Either you can create one more module which can be child to parent pom and parent to rest of modules to share one application.properties across whole project or you can use maven-remote-resources-plugin to use a remote resource bundle
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install disruptor
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page