GithubHelp home page GithubHelp logo

jcommon's Introduction

jcommon

jcommon: a set of libraries used inside Facebook java projects, internal and open source.

Requirements

jcommon builds and is tested on both Java 8 and Java 11.

Building jcommon

Maven pom.xml files are provided as a convenience. However, we do not regularly test them, and do not consider them supported.

Additional information

We do not guarantee API or ABI stability. We do not tag specific versions, and no longer publish artifacts to Maven Central.

Pull requests are permitted, but not regularly reviewed.

License

jcommon is provided under the Apache License version 2.0, as found in the LICENSE file.

jcommon's People

Contributors

andrewcox avatar aru777 avatar bugok avatar cairnsjr avatar cibuild-fb avatar dain avatar ekuvardin avatar erichwang avatar hgschmie avatar jasonj-fb avatar jesboat avatar kevinwilfong avatar l3fang avatar martint avatar mdordal avatar nitay avatar rash67 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jcommon's Issues

A Bug in HyperLogLog implemetation

Hey, Guys
I find a serialization bug in HyperLogLog, I can not deserialize correctly from the byte array that I had serialized in before, after I checkout the HyperLogLog code, I find you forgot to calculate the nonZeroBucket. The code below is the test code. I am trying fix this bug, if you think I am right, please merge my PR, Thanks
`package me.line.hiro.filterAndAggregator;

import me.line.hiro.common.algorithm.HyperLogLog;

import org.junit.Test;

public class HyperLogLogTest {

@Test
public void testSeriaizer() {
    HyperLogLog hll = new HyperLogLog(16);
    for (int i = 0; i < 10000; i++) {
        hll.add(i);
    }
    System.out.println("original eatiminate: " + hll.estimate());
    System.out.println("original data:");
    opBucket(hll);
    System.out.println("currentSum: " + hll.getCurrentSum() + " nonZeroBcuket: " + hll.getNonZeroBuckets());

    System.out.println();
    HyperLogLog anothHll = new HyperLogLog(hll.buckets());
    System.out.println("deSerializer estiminate: " + anothHll.estimate());
    System.out.println("DeSerializer data : ");
    opBucket(anothHll);
    System.out.println("currentSum: " + anothHll.getCurrentSum() + " nonZeroBcuket: "
            + anothHll.getNonZeroBuckets());
}

private void opBucket(HyperLogLog hll) {
    int[] bucket = hll.buckets();
    int len = Math.min(20, bucket.length);
    for (int i = 0; i < len; i++) {
        System.out.print(bucket[i] + " ");
    }
    System.out.println();
}

}
`

`original eatiminate: 8975
original data:
9 10 9 13 9 12 10 9 10 9 9 12 15 10 9 10
currentSum: 0.019195556640625 nonZeroBcuket: 16

deSerializer estiminate: 8975
DeSerializer data :
9 10 9 13 9 12 10 9 10 9 9 12 15 10 9 10
currentSum: 0.019195556640625 nonZeroBcuket: 0`

fix race condition in MultiWindow*

There is a case we could undercount and no doubt happens; but the race condition period is very small; when we roll the bucket, each counter may choose to merge the previous "current" by value rather than keeping a ref. We don't guard updates to it during this time.

solutions with a RW lock solve it trivially, but reduce throughput from 20M/s to 13M/s as measured by one core on an older dev box.

Notes.

  1. I believe I have some optimistic concurrency/locking methods that may work with volatiles. While still slower, the RW-lock read-lock is expensive
  2. timw has noted a new way to store the bucketed counters, as one time-series, with breakpoints at the 60, 600, 3600, alltime. meaning, we'd compose a 60 + 540 + 3000 + rest and use composite counters for each of these ranges

int this, the counter is merged into only one and optimistic techniques become easier

ConcurrentLinkedHashMap --> Caffeine when Java-8 based

There is an unused dependency on an older version of ConcurrentLinkedHashMap. If it is used internally, please consider upgrading to Caffeine when Java 8 based. CLHM is now end-of-life and maintained only for Java 6 users. Guava's cache is in a similar state as there is no one left familiar with the implementation and Guava must remain Android compatible (~JDK6). Since I am no longer involved with Guava I can't speak to that cache's future, other than say there is no current owner.

Caffeine is a Java 8 rewrite of Guava's cache with additional features and higher performance.

Exception throwing flavors of java.util.function.* classes are missing.

The ExtSupplier, ExtRunnable, and ExtCallable classes are extremely useful, but all of the other interfaces in java.util.function are missing.

Along with adding these exception throwing interfaces, it would be nice if these interfaces had static factory methods that could convert an exception throwing version to a standard java.util version.
The method would take an exception throwing version and return a "quiet" version that wraps any checked exceptions in a runtime exceptions (UncheckedCheckedException).

fix the gh-pages build

quote, timw:
"Just an FYI: the jenkins build for jcommon was unhappy. With Aaron's
help, we traced it down to changing the github URL ("@gh" -> "@github")
and something to do with the "gh-pages" branch. Rather than mess with
figuring out the "gh-pages" issue, I changed it to only build "master"
(i.e., changed "Git -> Branches to build" from "**" to "master").

Please let me know if that's not a good thing to do. :)
"

Dependency convergence error

During building with Maven:

[WARNING]
Dependency convergence error for joda-time:joda-time:2.9.4 paths to dependency are:
+-com.facebook.jcommon:util:0.1.29
+-joda-time:joda-time:2.9.4
and
+-com.facebook.jcommon:util:0.1.29
+-com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.4
+-joda-time:joda-time:2.4

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.