压缩、加密、Java Serializable 回退和 Reader 回退都是可选项,需要按需开启;滚动部署时要按版本逐步升级(如 v3.5→v3.6→v3.7),先部署读支持再写入;Nippy 不保证字节输出稳定,不要依赖具体字节结果

(require '[taoensso.nippy :as nippy])
(nippy/thaw (nippy/freeze <my-value>))README 未说明
纯 Clojure 的高性能序列化库,替代慢速 reader 把数据快速写入数据库
Clojure 的快速序列化库,支持压缩、加密和 EDN 格式,用来高效存取 Clojure 数据结构。
核心能力
- 用 freeze/thaw 一对函数完成任意 Clojure 值的序列化与还原
- 覆盖全部标准数据类型,并支持扩展自定义类型
- 可选 LZ4 或 Zstandard 智能压缩
- 可选 AES128 加密
- 提供 thaw 转换器,便于检查与变换反序列化数据
容易踩的坑
- v3.9.0v3.9.0 (2026-09-06)最新正式版2026-09-06 · 2026-09-06 11:11 UTC
- Dependency: on Clojars
- Versioning: Break Versioning
This promotes v3.9.0-RC1 to final with a small fix and a few extra optimizations.
Major performance release. Includes automatic keyword caching, optional shared dictionaries, and many other optimizations that together yield up to 2x faster performance in several common cases.
As always, please test carefully before updating against production data, and report any unexpected problems - thank you! 🙏
BREAKING
Users of low-level
freeze-to-out!/freeze-to-bb!andthaw-from-in!/thaw-from-bb!, please note:If your freeze calls are wrapped in
with-cache, your thaw calls MUST likewise be wrapped (with matching session boundaries). This has always been true, but is extra important now that Nippy has automatic keyword caching enabled by default [03725ac].Rolling updates
Updating Nippy with a rolling deployment (>1 coexisting Nippy version)?
Then please ensure you update step by step (e.g. v3.5 → v3.6 → v3.7) so that read support is fully deployed before the corresponding writes might happen.
Shared dictionaries are opt-in: deploy v3.9 readers with matching dictionaries BEFORE enabling dictionary writes.
New byte output
v3.9 changes the byte output of several common Nippy data types, including repeated keywords and tightly packed strings, collections, and longs.
Almost no one should care about this, but mentioning for the tiny minority of users that depend on Nippy's byte output remaining stable.
Since v3.9.0-RC1 (2026-08-21)
- [fix] Cache: respect custom freezers [8f48e3c]
- [prf] Thaw: reduce cache allocations [67cceaa]
- [prf] Arrays: streamline indexed loops [4bec13b]
- [prf] Deftypes: streamline field reads [7d177f3]
- [doc] Benchmarks: update for v3.9.0 [715f78f]
Since v3.8.1 (2026-07-28)
- [fix]
write-long: supportLong/MIN_VALUE[2115360] - [fix] Cache: respect custom freezers [8f48e3c]
- [new] Add shared dictionaries [da69caf]
- [new] Update benchmark results [74eebdc, df391d2]
- [prf] Cache: auto-cache keywords [03725ac]
- [prf] Freeze: enable tight packing by default [2705bb1]
- [prf] Freeze: copy-free compression [e36a2ff]
- [prf] Freeze: fast-path common elements [bbff6c6]
- [prf] Freeze: streamline common paths [50a56ac]
- [prf] Freeze: optimize default header copy [79f17cd]
- [prf] Thaw: reduce cache allocations [67cceaa]
- [prf] Arrays: streamline indexed loops [4bec13b]
- [prf] Deftypes: streamline field reads [7d177f3]
- [prf] Thaw: direct transient loop for
read-into[5f05346] - [prf] Thaw: decode keywords from bytes [bff8c29]
- [prf] Thaw: build lists directly [5a417fc]
- [prf] Thaw: decode strings in place [2ac10be]
- [prf] Thaw: bulk-build short vectors [7fde2b1]
- [prf] Thaw: avoid header copies [d119f59]
- [prf] Crypto: reduce buffer copies [1b62a1d]
- [prf] Cache: use ArrayList for
read-cached[ecb1206] - [prf] Cache: identity maps for keywords [ac4958e]
- [prf] Cache: use mutable Java state [eecda2d]
- [doc] Benchmarks: update for v3.9.0 [715f78f]
- [doc] Update rolling deployment info [5ea1728]
- [doc] Remove unnecessary details [97f0252]
- [nop] Bump Encore from v3.169.1 to v3.171.0 [d44feec]
- [nop] Streaming: simplify dispatch [86a4c20]
- v3.9.0-RC1v3.9.0-RC1 (2026-08-21)pre-release2026-08-21 · 2026-08-21 05:15 UTC
查看更新说明
- Dependency: on Clojars
- Versioning: Break Versioning
This promotes v3.9.0-beta1 to release candidate with no changes.
Major performance release. Includes new automatic keyword caching, and many other optimizations that together yield up to 2x faster performance in several common cases.
Intended as a non-breaking release, but touches a lot of core code. As always please test carefully before using for anything important, and please report any unexpected problems - thank you! 🙏
Rolling updates
Updating Nippy with a rolling deployment (>1 coexisting Nippy version)?
Then please ensure you update step by step (e.g. v3.5 → v3.6 → v3.7) so that read support is fully deployed before the corresponding writes might happen.
New byte output
v3.9 changes the byte output of several common Nippy data types.
Almost no one should care about this, but mentioning for the tiny minority of users that depend on Nippy's byte output remaining stable.
Since v3.9.0-beta1 (2026-08-06)
No changes
Since v3.8.1 (2026-07-28)
- [fix]
write-long: supportLong/MIN_VALUE[2115360] - [new] Add shared dictionaries [da69caf]
- [new] Update benchmark results [df391d2]
- [prf] Cache: auto-cache keywords [03725ac]
- [prf] Freeze: enable tight packing by default [2705bb1]
- [prf] Freeze: copy-free compression [e36a2ff]
- [prf] Freeze: fast-path common elements [bbff6c6]
- [prf] Freeze: streamline common paths [50a56ac]
- [prf] Freeze: optimize default header copy [79f17cd]
- [prf] Thaw: direct transient loop for
read-into[5f05346] - [prf] Thaw: decode keywords from bytes [bff8c29]
- [prf] Thaw: build lists directly [5a417fc]
- [prf] Thaw: decode strings in place [2ac10be]
- [prf] Thaw: bulk-build short vectors [7fde2b1]
- [prf] Thaw: avoid header copies [d119f59]
- [prf] Crypto: reduce buffer copies [1b62a1d]
- [prf] Cache: use ArrayList for
read-cached[ecb1206] - [prf] Cache: identity maps for keywords [ac4958e]
- [prf] Cache: use mutable Java state [eecda2d]
- v3.9.0-beta1v3.9.0-beta1 (2026-08-06)pre-release2026-08-06 · 2026-08-06 07:38 UTC
查看更新说明
- Dependency: on Clojars
- Versioning: Break Versioning
BETA: for early testers only, not yet recommended for production.
Major performance release. Includes new automatic keyword caching, and many other optimizations that together yield up to 2x faster performance in several common cases.
Intended as a non-breaking release, but touches a lot of core code. As always please test carefully before using for anything important, and please report any unexpected problems - thank you! 🙏
Rolling updates
Updating Nippy with a rolling deployment (>1 coexisting Nippy version)?
Then please ensure you update step by step (e.g. v3.5 → v3.6 → v3.7) so that read support is fully deployed before the corresponding writes might happen.
New byte output
v3.9 changes the byte output of several common Nippy data types.
Almost no one should care about this, but mentioning for the tiny minority of users that depend on Nippy's byte output remaining stable.
Since v3.8.1 (2026-07-28)
- [fix]
write-long: supportLong/MIN_VALUE[2115360] - [new] Add shared dictionaries [da69caf]
- [new] Update benchmark results [df391d2]
- [prf] Cache: auto-cache keywords [03725ac]
- [prf] Freeze: enable tight packing by default [2705bb1]
- [prf] Freeze: copy-free compression [e36a2ff]
- [prf] Freeze: fast-path common elements [bbff6c6]
- [prf] Freeze: streamline common paths [50a56ac]
- [prf] Freeze: optimize default header copy [79f17cd]
- [prf] Thaw: direct transient loop for
read-into[5f05346] - [prf] Thaw: decode keywords from bytes [bff8c29]
- [prf] Thaw: build lists directly [5a417fc]
- [prf] Thaw: decode strings in place [2ac10be]
- [prf] Thaw: bulk-build short vectors [7fde2b1]
- [prf] Thaw: avoid header copies [d119f59]
- [prf] Crypto: reduce buffer copies [1b62a1d]
- [prf] Cache: use ArrayList for
read-cached[ecb1206] - [prf] Cache: identity maps for keywords [ac4958e]
- [prf] Cache: use mutable Java state [eecda2d]
- v3.9.0-alpha2v3.9.0-alpha2 (2026-07-29)pre-release2026-07-29 · 2026-07-29 03:39 UTC
查看更新说明
- Dependency: on Clojars
- Versioning: Break Versioning
EARLY PREVIEW: only for early testers, not suitable for production.
Major performance release. Includes new automatic keyword caching, and many other optimizations that together yield up to 2x faster performance in several common cases.
Intended as a non-breaking release, but touches a lot of core code. As always please test carefully before using for anything important, and please report any unexpected problems - thank you! 🙏
Rolling updates
Updating Nippy with a rolling deployment (>1 coexisting Nippy version)?
Then please ensure you update step by step (e.g. v3.5 → v3.6 → v3.7) so that read support is fully deployed before the corresponding writes might happen.
New byte output
v3.9 changes the byte output of several common Nippy data types.
Almost no one should care about this, but mentioning for the tiny minority of users that depend on Nippy's byte output remaining stable.
Since v3.8.1 (2026-07-28)
- [new] Update benchmark results [df391d2]
- [prf] Cache: auto-cache keywords [03725ac]
- [prf] Freeze: enable tight packing by default [2705bb1]
- [prf] Freeze: copy-free compression [e36a2ff]
- [prf] Freeze: fast-path common elements [bbff6c6]
- [prf] Freeze: streamline common paths [50a56ac]
- [prf] Freeze: optimize default header copy [79f17cd]
- [prf] Thaw: direct transient loop for
read-into[5f05346] - [prf] Thaw: decode keywords from bytes [bff8c29]
- [prf] Thaw: build lists directly [5a417fc]
- [prf] Thaw: decode strings in place [2ac10be]
- [prf] Thaw: bulk-build short vectors [7fde2b1]
- [prf] Thaw: avoid header copies [d119f59]
- [prf] Crypto: reduce buffer copies [1b62a1d]
- [prf] Cache: use ArrayList for
read-cached[ecb1206] - [prf] Cache: identity maps for keywords [ac4958e]
- [prf] Cache: use mutable Java state [eecda2d]
- v3.8.1v3.8.1 (2026-07-28)2026-07-28 · 2026-07-28 08:53 UTC
查看更新说明
- Dependency: on Clojars
- Versioning: Break Versioning
Hotfix release, should be a safe update for users on v3.8.0 - but as always please test carefully before using in production, and please report any unexpected problems - thank you! 🙏
Since v3.8.0 (2026-07-26)
- [fix]
freeze-to-out!: restore size-unlimited streaming [2613609] - [fix]
with-bb: cap buffer growth at max array size [930a3cb] - [sec] Thaw: validate buffered allocation lengths [ca0fa4f]
- [fix] Thaw: reject negative collection counts [b2e16e9]
- [fix] Crypto: reject truncated encrypted payloads [fe8ab01]
- [fix]
with-cache: restore outer cache [c368c4a] - [fix]
freeze-to-out!: restore cache on failure [bb8078b] - [fix]
freeze-to-bb!: restore state on failure [c0b2228] - [fix]
write-sz: serialize before writing header [7bc1e3e]
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
API | Wiki | Support | Latest release: v3.9.0 (2026-09-06)
Nippy
Fast serialization library for Clojure
Clojure's rich data types are awesome. And its reader allows you to take your data just about anywhere. But the reader can be painfully slow when you've got a lot of data to crunch (like when you're serializing to a database).
Nippy is a mature, high-performance drop-in alternative to the reader.
It is used at scale by Carmine, Faraday, PigPen, Onyx, XTDB, Datalevin, and others.
Why Nippy?
- Small, simple pure-Clojure library
- Terrific performance: the best for Clojure that I'm aware of
- Comprehensive support for all standard data types
- Easily extendable to custom data types
- Robust test suite incl. coverage of every supported type
- Mature and widely used in production for 12+ years
- Optional auto fallback to Java Serializable for safe types
- Optional auto fallback to Clojure Reader (including tagged literals)
- Optional smart compression with LZ4 or Zstandard
- Optional encryption with AES128
- Tools for easy + robust integration into 3rd-party libraries, etc.
- Powerful thaw transducer for flexible data inspection and transformation
Quick example
Nippy's super easy to use:
(require '[taoensso.nippy :as nippy])
;; Freeze any Clojure value
(nippy/freeze <my-value>) ; => Serialized byte[]
;; Thaw the byte[] to get back the original value:
(nippy/thaw (nippy/freeze <my-value>)) ; => <my-value>
See the wiki for more.
Operational considerations
Data longevity
Nippy is widely used to store long-lived data and promises (as always) that data serialized today should be readable by all future versions of Nippy.
But please note that the converse is not generally true:
- Nippy
vXshould be able to read all data from NippyvY<=X(backwards compatibility) - Nippy
vXmay/not be able to read all data from NippyvY>X(forwards compatibility)
Rolling updates and rollback
From time to time, Nippy may introduce:
- Support for serializing new types
- Optimizations to the serialization of pre-existing types
To help better support rolling deployments and rollback, Nippy will always introduce such changes over two version releases:
- Release 1: to add read support for the new types
- Release 2: to add write support for the new types
So if you use rolling deployments please ensure you update step by step (e.g. v3.5 → v3.6 → v3.7) so that read support is fully deployed before the corresponding writes might happen.
Stability of byte output
It has never been an objective of Nippy to offer predictable byte output, and I'd generally recommend against depending on specific byte output.
However, I know that a small minority of users do have specialized needs in this area.
So starting with Nippy v3.4, Nippy's release notes will always clearly indicate if any changes to byte output are expected.
Performance
Nippy is pretty fast. Latest benchmark results:

PRs welcome to include other alternatives in the bench suite!
Documentation
Funding
You can help support continued work on this project and others, thank you!! 🙏
License
Copyright © 2012-2026 Peter Taoussanis.
Licensed under EPL 1.0 (same as Clojure).