Comments (9)
The design of Striped64 is that once it creates additional Cells due to contention that it won't remove them afterwards, on the basis that you're likely to have that level of concurrency again in the future.
https://github.com/prometheus/client_java/blob/master/simpleclient/src/main/java/io/prometheus/client/Striped64.java#L17 has more detail.
Would this explain what you're seeing?
from client_java.
I know a design a solution, question is: Do we need to store own class in a ThreadLocal storage?
I found only one place where it's used. It's in DoubleAdder:
int h = (hc = threadHashCode.get()).code;
Maybe you can store generated hashCode as an Integer, not HashCode inner class ?
from client_java.
This code is copied from a recent versions of Java (older versions are missing it), so I'm afraid I can't comment on the exact implementation details. If there's a newer upstream version I'll be happy to update our copy.
from client_java.
This is not a master repo for prometheus libraries? Should I prepare a Pull request for that?
Sorry I didn't got your answer..
from client_java.
This is the master repo for the Prometheus java library. The code in question is from JCP JSR-166 and is included in Java 8 for example. As not all versions of Java include this library, we've copied it into this repository to avoid the need for users to pull in dependencies.
If there's an issue with this code, it should be fixed in the core Java libraries so that everyone can benefit.
from client_java.
In a latest version of Stped64 in Java code:
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ce1c874903cb/src/share/classes/java/util/concurrent/atomic/Striped64.java
they are storing a Double (via ThreadLocalRandom class)
In a JSR proposal:
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/Striped64.java?view=co
they are storing an array of integers
So nobody is storing own Inner classes, only basic types to do not lock-down a classloader
from client_java.
I see Prometheus client already has a dependency on Guava and Guava has its own implementation of Striped64, very similar to yours but using ThreadLocal<int[]>
instead of ThreadLocal<HashCode>
(at least in Guava 18.0).
If you don't want to keep maintaining your own version of Striped64 and fixing memory issues, just use the version from Guava.
from client_java.
The original java client has dependencies, however the simpleclient (which we're discussing here). I haven't worked through the fully history yet, but if there's a newer version that works as far back as Java 6 I'll be happy to accept a PR to update our copy.
from client_java.
This should be resolved with #70
from client_java.
Related Issues (20)
- Implement UTF8 Support HOT 6
- StatefulMetric.clear() is not implemented HOT 1
- Promethus Core Counter and Gauge Query HOT 2
- Metric `process_cpu_seconds_total` is in wrong order of magnitude HOT 1
- Added the ability to configured the HTTPServer socket timeout HOT 1
- PushGateway and JettyStatisticsCollector support in version 1 HOT 3
- Endpoint actuator/prometheus not working on macOS HOT 1
- Publish a BOM again
- Implement latest changes in the Prometheus Protobuf format
- [httpserver exporter] No option to specify a wait time for ongoing requests when closing the server HOT 3
- Explicit Exception for Duplicate Labels during Scrape HOT 1
- Stress test failure in DropwizardExportsTest HOT 2
- Stress test failure in SlidingWindowTest HOT 1
- dropwizard5 MapperConfig doesn't rename the metric? HOT 4
- How to remove all metrics in the defaultRegistry HOT 5
- Failing while building simpleclient_httpserver version parent-0.15.0 using mvn clean install HOT 4
- log4j2 instrumentation support for 1.X?
- Flaky test - SlidingWindowTest
- Filter parameter causes HTTP Status 400 – Bad Request HOT 1
- info required for compatible version with openjdk21 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client_java.