{"id":13801609,"url":"https://github.com/twitter/chill","last_synced_at":"2025-07-09T22:43:13.168Z","repository":{"id":5073018,"uuid":"6235080","full_name":"twitter/chill","owner":"twitter","description":"Scala extensions for the Kryo serialization library","archived":false,"fork":false,"pushed_at":"2024-08-19T21:32:21.000Z","size":1254,"stargazers_count":615,"open_issues_count":75,"forks_count":154,"subscribers_count":129,"default_branch":"develop","last_synced_at":"2025-07-08T03:39:38.005Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://twitter.com/scalding","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"twitter/secureheaders","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twitter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-10-15T22:01:08.000Z","updated_at":"2025-07-04T04:03:01.000Z","dependencies_parsed_at":"2024-06-19T01:42:25.400Z","dependency_job_id":"b73df232-32b6-4f6a-bcf0-ee5995a39cb3","html_url":"https://github.com/twitter/chill","commit_stats":{"total_commits":712,"total_committers":75,"mean_commits":9.493333333333334,"dds":0.7205056179775281,"last_synced_commit":"9ebad0afce667ee04c6670c631f15227c3aed155"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/twitter/chill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Fchill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Fchill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Fchill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Fchill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twitter","download_url":"https://codeload.github.com/twitter/chill/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Fchill/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504616,"owners_count":23618831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:24.919Z","updated_at":"2025-07-09T22:43:13.148Z","avatar_url":"https://github.com/twitter.png","language":"Scala","readme":"## Chill\n\n![build](https://github.com/twitter/chill/workflows/ci/badge.svg)\n[![Codecov branch](https://img.shields.io/codecov/c/github/twitter/chill/develop.svg?maxAge=3600)](https://codecov.io/github/twitter/chill)\n[![Latest version](https://index.scala-lang.org/twitter/chill/chill/latest.svg?color=orange)](https://index.scala-lang.org/twitter/chill/chill)\n[![Chat](https://badges.gitter.im/twitter/chill.svg)](https://gitter.im/twitter/chill?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nExtensions for the [Kryo serialization library](https://github.com/EsotericSoftware/kryo) including\nserializers and a set of classes to ease configuration of Kryo in systems like Hadoop, Storm,\nAkka, etc.\n\n### Compatibility\n\nSerialization compatibility is **NOT** guaranteed between releases, and for this reason, we don't recommend using it for long-term storage. Serialization is highly dependent on scala version compatibility and on the underlying Kryo serializers, which take different approaches to compatibility.\n\n### Building Chill\n\n```bash\n\u003e sbt\nsbt:chill-all\u003e  compile # to build chill\nsbt:chill-all\u003e  publishM2 # to publish chill to your local .m2 repo\nsbt:chill-all\u003e  publishLocal # publish to local ivy repo.\n```\n\nChill has a set of subprojects: chill-java, chill-hadoop, chill-storm and chill-scala.  Other than\nchill-scala, all these projects are written in Java so they are easy to use on any JVM platform.\n\n## Chill-Java\n\nThe chill-java package includes the `KryoInstantiator` class (factory for Kryo instances)\nand the `IKryoRegistrar` interface (adds Serializers to a given Kryo). These two are composable\nto build instantiators that create instances of Kryo that have the options and serializers you\nneed. The benefit of this over a direct Kryo instance is that a Kryo instance is mutable and not\nserializable, which limits the safety and reusability of code that works directly with them.\n\nTo deserialize or serialize easily, look at `KryoPool`:\n\n```java\nint POOL_SIZE = 10;\nKryoPool kryo = KryoPool.withByteArrayOutputStream(POOL_SIZE, new KryoInstantiator());\nbyte[] ser = kryo.toBytesWithClass(myObj);\nObject deserObj = kryo.fromBytes(myObj);\n```\n\nThe KryoPool is a thread-safe way to share Kryo instances and temporary output buffers.\n\n### Chill Config\n\nHadoop, Storm, and Akka all use a configuration that is basically equivalent to a `Map[String,\nString]`. The `com.twitter.chill.config` package makes it easy to build up `KryoInstantiator`\ninstances given a Config instance, which is an abstract class acting as a thin wrapper over\nwhatever configuration data the system, such as Hadoop, Storm or Akka, might give.\n\nTo configure a KryoInstantiator use `ConfiguredInstantiator` with either reflection,\nwhich takes a class name and instantiates that KryoInstantiator, or an instance of KryoInstantiator\nand serializes that instance to use later:\n```scala\nclass TestInst extends KryoInstantiator { override def newKryo = sys.error(\"blow up\") }\n\n// A new Config:\nval conf = new JavaMapConfig\n// Set-up class-based reflection of our instantiator:\nConfiguredInstantiator.setReflect(conf, classOf[TestInst])\nval cci = new ConfiguredInstantiator(conf)\ncci.newKryo // uses TestInst\n//Or serialize a particular instance into the config to use later (or another node):\n\nConfiguredInstantiator.setSerialized(conf, new TestInst)\nval cci2 = new ConfiguredInstantiator(conf)\ncci2.newKryo // uses the particular instance we passed above\n```\n\n## Chill in Scala\n\nScala classes often have a number of properties that distinguish them from usual Java classes. Often\nscala classes are immutable, and thus have no zero argument constructor. Secondly, `object` in scala is\na singleton that needs to be carefully serialized. Additionally, scala classes often have synthetic\n(compiler generated) fields that need to be serialized, and by default Kryo does not serialize\nthose.\n\nIn addition to a `ScalaKryoInstantiator` which generates Kryo instances with options suitable for\nscala, chill provides a number of Kryo serializers for standard scala classes (see below).\n\n### The MeatLocker\n\nMany existing systems use Java serialization. MeatLocker is an object that wraps a given instance\nusing Kryo serialization internally, but the MeatLocker itself is Java serializable.\nThe MeatLocker allows you to box Kryo-serializable objects and deserialize them lazily on the first call to `get`:\n\n```scala\nimport com.twitter.chill.MeatLocker\n\nval boxedItem = MeatLocker(someItem)\n\n// boxedItem is java.io.Serializable no matter what it contains.\nval box = roundTripThroughJava(boxedItem)\nbox.get == boxedItem.get // true!\n```\n\nTo retrieve the boxed item without caching the deserialized value, use `meatlockerInstance.copy`.\n\n### Serializers for Scala classes\n\nThese are found in the `chill-scala` directory in the chill jar (originally this project was\nonly scala serializers).  Chill provides support for singletons, scala Objects and the following types:\n\n* Scala primitives\n  * scala.Enumeration values\n  * scala.Symbol\n  * scala.reflect.Manifest\n  * scala.reflect.ClassManifest\n  * scala.Function[0-22] closure cleaning (removing unused `$outer` references).\n* Collections and sequences\n  * scala.collection.immutable.Map\n  * scala.collection.immutable.List\n  * scala.collection.immutable.Vector\n  * scala.collection.immutable.Set\n  * scala.collection.mutable.{Map, Set, Buffer, WrappedArray}\n  * all 22 scala tuples\n\n## Chill-bijection\n\n[Bijections and Injections](https://github.com/twitter/bijection) are useful when considering serialization. If you have an Injection from `T` to `Array[Byte]` you have a serialization.  Additionally, if you have a Bijection between `A` and `B`, and a serialization for `B`, then you have a serialization for `A`.  See `BijectionEnrichedKryo` for easy interop between bijection and chill.\n\n### KryoInjection: easy serialization to byte Arrays\n\nKryoInjection is an injection from `Any` to `Array[Byte]`. To serialize using it:\n\n```scala\nimport com.twitter.chill.KryoInjection\n\nval bytes:  Array[Byte]    = KryoInjection(someItem)\nval tryDecode: scala.util.Try[Any] = KryoInjection.invert(bytes)\n```\n\nKryoInjection can be composed with Bijections and Injections from `com.twitter.bijection`.\n\n## Chill-Akka\n\nTo use, add a key to your config like:\n```\n    akka.actor.serializers {\n      kryo = \"com.twitter.chill.akka.AkkaSerializer\"\n    }\n```\n\nThen for the super-classes of all your message types, for instance, `java.io.Serializable` (all case classes and case objects are serializable), write:\n```scala\n   akka.actor.serialization-bindings {\n     \"java.io.Serializable\" = kryo\n   }\n```\n\nWith this in place you can now [disable Java serialization entirely](https://doc.akka.io/docs/akka/current/remoting.html#disable-java-serializer):\n\n```scala\nakka.actor {\n  # Set this to on to enable serialization-bindings defined in\n  # additional-serialization-bindings. Those are by default not included\n  # for backwards compatibility reasons. They are enabled by default if\n  # akka.remote.artery.enabled=on.\n  enable-additional-serialization-bindings = on\n  \n  allow-java-serialization = off\n}\n```\n\n\nIf you want to use the `chill.config.ConfiguredInstantiator` see `ConfiguredAkkaSerializer`\notherwise, subclass `AkkaSerializer` and override `kryoInstantiator` to control how the `Kryo`\nobject is created.\n\n## Documentation\n\nTo learn more and find links to tutorials and information around the web, check out the [Chill Wiki](https://github.com/twitter/chill/wiki).\n\nThe latest ScalaDocs are hosted on Chill's [Github Project Page](http://twitter.github.io/chill).\n\n## Contact\n\nDiscussion occurs primarily on the [Chill mailing list](https://groups.google.com/forum/#!forum/chill-user). Issues should be reported on the [GitHub issue tracker](https://github.com/twitter/chill/issues).\n\n## Get Involved + Code of Conduct\n\nPull requests and bug reports are always welcome!\n\nWe use a lightweight form of project governance inspired by the one used by Apache projects.\nPlease see [Contributing and Committership](https://github.com/twitter/analytics-infra-governance#contributing-and-committership) for our code of conduct and our pull request review process.\nThe TL;DR is send us a pull request, iterate on the feedback + discussion, and get a +1 from a [Committer](COMMITTERS.md) in order to get your PR accepted.\n\nThe current list of active committers (who can +1 a pull request) can be found here: [Committers](COMMITTERS.md)\n\nA list of contributors to the project can be found here: [Contributors](https://github.com/twitter/chill/graphs/contributors)\n\n## Maven\n\nChill modules are available on Maven Central. The current groupid and version for all modules is, respectively, `\"com.twitter\"` and  `0.10.0`. Each scala project is published for `2.11`, `2.12` and `2.13`. Search [search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Cchill) when in doubt.\n\n`chill-scala` is not published separately; to use it, reference `chill`. To add the dependency to your project using SBT:\n\n    \"com.twitter\" %% \"chill\" % \"0.10.0\"\n\n## Authors\n\n* Oscar Boykin \u003chttps://twitter.com/posco\u003e\n* Mike Gagnon \u003chttps://twitter.com/MichaelNGagnon\u003e\n* Sam Ritchie \u003chttps://twitter.com/sritchie\u003e\n\n## License\n\nCopyright 2012 Twitter, Inc.\n\nLicensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n\n## Thanks to Yourkit\nYourKit supports open source projects with innovative and intelligent tools\nfor monitoring and profiling Java and .NET applications.\nYourKit is the creator of \u003ca href=\"https://www.yourkit.com/java/profiler/\"\u003eYourKit Java Profiler\u003c/a\u003e,\n\u003ca href=\"https://www.yourkit.com/.net/profiler/\"\u003eYourKit .NET Profiler\u003c/a\u003e,\nand \u003ca href=\"https://www.yourkit.com/youmonitor/\"\u003eYourKit YouMonitor\u003c/a\u003e.\n","funding_links":[],"categories":["Table of Contents","Serialization"],"sub_categories":["Serialization"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter%2Fchill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwitter%2Fchill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter%2Fchill/lists"}