10 ms·
TernFS – An exabyte scale, multi-region distributed filesystem
- mrbluecoat 1y agoCool project and kudos for open sourcing it. Noteworthy limitation: > TernFS should not be used for tiny files — our median file size is 2MB.
- heipei 1y agoYeah, that was the first thing I checked as well. Being suited for small / tiny files is a great property of the SeaweedFS system.
- pandemic_region 1y agoWhat happens if you put a tiny file on it then? Bad perf, possible file corruption, ... ?
- redundantly 1y agoProbably wasting space and lower performance.
- jleahy 1y agoIt's just not optimised for tiny files. It absolutely would work with no problems at all, and you could definitely use it to store 100 billion 1kB files with zero problems (and that is 100 terabytes of data, probably on flash, so no joke). However you can't use it to store 1 exabyte of 1 kilobyte files (at least not yet).
- KaiserPro 1y agoBad space efficiency and possibly exhausting your inode system (ie there is space left on the device, but you can't put any files on it)
- jandrewrogers 1y agoI have worked on exabyte-scale storage engines. There is a good engineering reason for this type of limitation. If you had 1 KiB average file size then you have quadrillions of metadata objects to quickly search and manage with fine-granularity. The kinds of operations and coordination you need to do with metadata is difficult to achieve reliably when the metadata structure itself is many PB in size. There are interesting edge cases that show up when you have to do deep paging of this metadata off of storage. Making this not slow requires unorthodox and unusual design choices that introduce a lot of complexity. Almost none of the metadata fits in memory, including many parts of conventional architectures we assume will always fit in memory. A mere trillion objects is right around the limit of where the allocators, metadata, etc can be made to scale with heroic efforts before conventional architectures break down and things start to become deeply weird on the software design side. Storage engines need to be reliable, so avoiding that design frontier makes a lot of sense if you can avoid it. It is possible to break this barrier but it introduces myriad interesting design and computer science problems for which there is little literature.
- stuartjohnson12 1y agoThis sounds like a fascinating niche piece of technical expertise I would love to hear more about. What are the biggest challenges in scaling metadata from a trillion to a quadrillion objects?
- jandrewrogers 1y agoIt is dependent on the intended workload but there are a few common design problems. Keep in mind that you can't just deal in the average case, you have to design for the worst possible cases of extremely skewed or pathologically biased distributions. A lot of the design work is proving worst case resource bounds under various scenarios and then proving the worst case behavior of designs intended to mitigate that. An obvious one is bulk deletion, which is rarely fast at any scale. This may involve trillions of updates to search indexing structures, which in naive implementations could look like pointer-chasing across disk. Releasing storage to allocators has no locality because you are streaming the allocations to release off that storage in semi-random order. It is unhelpfully resistant to most scheduling-based locality optimization techniques. You also want to parallelize this as much as possible and some of these allocators will be global-ish. The most interesting challenge to me is meta-scheduling. Cache replacement algorithms usually don't provide I/O locality at this scale so standard mitigations for cache-resistant workloads like dynamic schedule rewriting and latency-hiding are used instead. Schedulers are in the center of the hot path so you really want these to be memory-resident and fast. Their state size is loosely correlated with the number of objects, so in some extreme cases these can easily exceed available memory on large servers. You can address this by designing a "meta-scheduler" that adaptively optimizes the scheduling of scheduler state, so that the right bits are memory-resident at the right time so that the scheduler can optimally schedule its workload. It is difficult to overstate how much of a breaking change to conventional architecture this turns out to be. These add some value even if the state is memory resident but they greatly increase design complexity and make tail latencies more difficult to manage. A more basic challenge is that you start dealing with numbers that may not be representable in 64-bits. Similarly, many popular probabilistic algorithms may not offer what you need when the number of entities is this large. I aggressively skirted these issues for a long time before relenting. I deal more with database storage engines than filesystems, but to a first approximation "files" and "shards" are equivalent for these purposes.
- Eikon 1y agoShameless plug: https://github.com/Barre/ZeroFS https://github.com/Barre/ZeroFS I initially developed it for a usecase where I needed to store billions of tiny files, and it just requires a single s3 bucket as infrastructure.
- Datagenerator 1y agoInteresting, can I use SeaweedFS as bucket provider?
- HackerNewt-doms 1y ago> ZeroFS - The Filesystem That Makes S3 your Primary Storage. What is the motivation to use s3 as primary storage?
- stonogo 1y ago...which places it firmly in the "just like every other so-called exascale file system." We already had GPFS...
- ttfvjktesd 1y agoHow does TernFS compare to CephFS and why not CephFS, since it is also tested for the multiple Petabyte range?
- rostayob 1y ago(Disclaimer: I'm one of the authors of TernFS and while we evaluated Ceph I am not intimately familiar with it) Main factors: * Ceph stores both metadata and file contents using the same object store (RADOS). TernFS uses a specialized database for metadata which takes advantage of various properties of our datasets (immutable files, few moves between directories, etc.). * While Ceph is capable of storing PBs, we currently store ~600PBs on a single TernFS deployment. Last time we checked this would be an order of magnitude more than even very large Ceph deployments. * More generally, we wanted a system that we knew we could easily adapt to our needs and more importantly quickly fix when something went wrong, and we estimated that building out something new rather than adapting Ceph (or some other open source solution) would be less costly overall.
- mgrandl 1y agoThere are definitely insanely large Ceph deployments. I have seen hundreds of PBs in production myself. Also your usecase sounds like something that should be quite manageable for Ceph to handle due to limited metadata activity, which tends to be the main painpoint with CephFS.
- kachapopopow 1y agoCeph is more of: here's a raw block of data, do whatever the hell you want with it, not really good for immutable data.
- mgrandl 1y agoWell sure you would have to enforce immutability at the client side.
- sreekanth850 1y agoWow, great project.
- nunobrito 1y agoThanks for sharing.
- bananapub 1y agoseems like a colossusly nice design.
- VikingCoder 1y agoI see what you did there.
- jleahy 1y agocould be a tectonic shift in the open source filesystem landscape?
- arcade79 1y agoSadly lacking a nice big table to lay out the metadata on.
- eigenvalue 1y agoThis sounds like it would be a good underpinning for a decentralized blockchain file storage system with its focus on immutability and redundancy.
- mrtesthah 1y agoAnd yet no one needed a blockchain to implement this.
- MadnessASAP 1y agoBut a blockchain is already immutable. It becomes decentralised and redundant if you have multiple nodes sharing blocks. No need for an underpinning, it is the underpinning.
- KaiserPro 1y agoif you're storing the blocks in one place, its not decentralised. The metadata would be crucial for performance, and given that I assume you'll want a full chain of history for every file, your metadata table will get progressively bigger every time you do any kind of metadata operation. Plus you can only have one person write metadata at one time, so you're gonna get huge top of line blocking.
- mdaniel 1y agoGPLv2-or-later, in case you were wondering https://github.com/XTXMarkets/ternfs/blob/7a4e466ac655117d24400dc17f817a4ed6e7c9ca/README.md#licensing https://github.com/XTXMarkets/ternfs/blob/7a4e466ac655117d24...
- coolspot 1y agoLicensing TernFS is Free Software. The default license for TernFS is GPL-2.0-or-later. The protocol definitions (go/msgs/), protocol generator (go/bincodegen/) and client library (go/client/, go/core/) are licensed under Apache-2.0 with the LLVM-exception. This license combination is both permissive (similar to MIT or BSD licenses) as well as compatible with all GPL licenses. We have done this to allow people to build their own proprietary client libraries while ensuring we can also freely incorporate them into the GPL v2 licensed Linux kernel.
- rickette 1y agoOver 500PB of data, wow. Would love to know how and why "statistical models that produce price forecasts for over 50,000 financial instruments worldwide" require that much storage.
- Beijinger 1y agoMe too. Is is really hard for me to understand, what XTX is actually doing. Trading? VC? AI/ML? Have you seen their portfolio? PS: Company seems legit. Impressive growth. But I still don't understand what they are doing. Provide "electronic liquidity". Well....
- guerby 1y agoIf you keep all order book changes for a large number of financial instruments volume adds up quickly.
- rickette 1y agoWould that kind of data not compress like crazy? Or would they need to keep all that data hot and fast.
- guerby 1y agoFrom just a single exchange you can reach up to 1 million messages of order book change per second https://www.nasdaqtrader.com/snippets/inet2.html https://www.nasdaqtrader.com/snippets/inet2.html Message Volume 1,684,103,265 Messages per Second 1,134,640 Order Volume 871,875,595 Orders per Second 581,696 Share Volume 12,814,454,760 Executions per Second 193,350 Also if you look at equity derivative products which have parameters like type call/put, strike, maturity can be hundreds of financial products for one underlying stock. I worked in this sector and volume of data is a real challenge, no wonder you often get custom software to handle that :)
- eps 1y agoThat was a good read. Compliments to the chefs. It'd be helpful to have a couple of usage examples that illustrate common operations, like creating a file or finding and reading one, right after the high-level overview section. Just to get an idea what happens at the service level in these cases.
- bitonico 1y agoYes, that would be very useful, we just didn't get to it and we didn't want perfect to be the enemy of good, since otherwise we would have never open sourced :). But if we have the time it would definitely be a good addition to the docs.
- Beijinger 1y agoThanks a lot. Regarding your company, it is really hard for me to understand, what XTX is actually doing. Trading? VC? AI/ML?
- jleahy 1y agoTrading using ML.
- d12bb 1y ago> The firm started out with a couple of desktops and an NFS server, and 10 years later ended up with tens of thousands of high-end GPUs, hundreds of thousands of CPUs, and hundreds of petabytes of storage. So much resources for producing nothing of real value. What a waste. Great project though, appreciate open sourcing it.
- EugeneG 1y agoIn theory what they are doing of value, is that at any time you can go to an exchange and say "I want to buy x" or "I want to sell y" and someone will buy it from you our sell it from you... at a price that's likely to be the accurate price. At the extreme if nobody was providing this service, investors (e.g. pension funds), wouldn't be confident that they can buy/sell their assets as needed in size and at the right price... and because of that, in aggregate stocks would be worth less, and companies wouldn't be able to raise as much capital. The theoretical model is: - You want to have efficient primary markets that allow companies to raise a lot of assets at the best possible prices - To enable efficient primary markets, investors want efficient secondary markets (so they don't need to buy and hold forever, but feel they can sell) - To enable efficient secondary markets, you need many folks that are in the business of XTX ... it just so happens that XTX is quite good at it, and so they do a lot of this work.
- lsecondario 1y ago> In theory > At the extreme > The theoretical model These qualifiers would seem to belie the whole argument. Surely the volume of HFT arbitrage is some large multiple of what would be necessary to provide commercial liquidity with an acceptable spread?
- formerly_proven 1y agoDoes the HFT volume actually matter? Is it a real problem that the HFT volume exceeds the theoretical minimum amount of volume needed to maintain liquid markets?
- candiddevmike 1y ago
- doctorpangloss 1y agoHa ha, I forecast, SPY goes up, and I’ve already made more money than XTX or any of its clients… Look I like technology as much as anyone. Improbable spent $500 million on product development, and its most popular product is its grpc-web client. It didn't release any of its exotic technology. You could also go and spend that money on making $500m of games without any exotic technology, and also make it open source.
- hintymad 1y ago> Most of the metadata activity is contained within a single shard: > > - File creation, same-directory renames, and deletion. > - Listing directory contents. > - Getting attributes of files or directories. I guess this is a trade-off between a file system and an object store? As in S3, ListObjects() is a heavy hitter and there can be potentially billions of objects under any prefix. Scanning only on a single instance won't be sufficient.
- jeffinhat 1y agoIt's definitely a different use case but given they haven't had to tap into their follower replicas for scale, it must be pretty efficient and lightweight. I suspect not having ACLs helps. They also cite a minimum 2MB size, so not expecting exabtyes of little bytes. I wonder if a major difference is listing a prefix in object storage vs performing recursive listings in a file system? Even in S3, performing very large lists over a prefix is slow and small files will always be slow to work with, so regular compaction and catching file names is usually worthwhile.
- jleahy 1y ago2MB median to be fair, so half of our files are under 2MB.
- YouAreWRONGtoo 1y ago[dead]
- hardwaregeek 1y agoHudson River Trading's distributed file system for comparison: https://www.hudsonrivertrading.com/hrtbeat/distributed-filesystem-for-scalable-research/ https://www.hudsonrivertrading.com/hrtbeat/distributed-files...
- rickette 1y agoCool. Also https://github.com/deepseek-ai/3FS https://github.com/deepseek-ai/3FS by DeepSeek which came out of High-Flyer a Chinese HFT firm.
- harshaw 1y agoSounds more like an object system (immutable) with the veneer of a file system for their use cases. I sort of read the doc - sounds like data is replicated and not erasure encoded (so perhaps more expensive?). I think many people have said this, but "file systems" get a lot easier if you don't have to worry about overwrites, appends, truncates, etc. Anyway, always interesting to see what people come up with for their use cases.
- rostayob 1y agoWe do use Reed-Solomon codes, as the blog post explains.
- Balinares 1y agoAppend-only is pretty much the only way to do robust replicated storage at scale, else you get into scenarios where, instead of a given logical block having two possible states (either existing somewhere or not existing anywhere), the block can exist with multiple values at different times, including an unbounded number of invalid ones, for instance in case a client died halfway through a block mutation. Immutability is just plain a very strong invariant. It also does not at all preclude implementing a read-write layer on top of it, for instance with a log-structured FS design. That's however the solution to a problem these people are, it seems, not having.
- charleshn 1y agoA few questions if the authors are around! > Is hardware agnostic and uses TCP/IP to communicate. So no RDMA? It's very hard to make effective use of modern NVMe drives bandwidth over TCP/IP. > A logical shard is further split into five physical instances, one leader and four followers, in a typical distributed consensus setup. The distributed consensus engine is provided by a purpose-built Raft-like implementation, which we call LogsDB Raft-like, so not Raft, a custom algorithm? Implementing distributed consensus correctly from scratch is very hard - why not use some battle-tested implementations? > Read/write access to the block service is provided using a simple TCP API currently implemented by a Go process. This process is hardware agnostic and uses the Go standard library to read and write blocks to a conventional local file system. We originally planned to rewrite the Go process in C++, and possibly write to block devices directly, but the idiomatic Go implementation has proven performant enough for our needs so far. The document mentions it's designed to reach TB/s though. Which means that for an IO intensive workload, one would end up wasting a lot of drive bandwidth, and require a huge number of nodes. Modern parallel filesystems can reach 80-90GB/s per node, using RDMA, DPDK etc. > This is in contrast to protocols like NFS, whereby each connection is very stateful, holding resources such as open files, locks, and so on. This is not true for NFSv3 and older, it tends to be stateless (no notion of open file). No mention of the way this was developed and tested - does it use some formal methods, simulator, chaos engineering etc?
- foota 1y agoOut of curiosity, you seem knowledgeable here, is it possible to do NVME over RDMA in public cloud (e.g., on AWS)? I was recently looking into this and my conclusion was no, but I'd love to be wrong :)
- stonogo 1y agoAmazon FSx for Lustre is the product. They do have information on DIY with the underlying tech: https://aws.amazon.com/blogs/hpc/scaling-a-read-intensive-low-latency-file-system-to-10m-iops/ https://aws.amazon.com/blogs/hpc/scaling-a-read-intensive-lo...
- chatmasta 1y ago> There's a reason why every major tech company has developed its own distributed filesystem I haven't worked at FAANG, but is this a well-known fact? I've never heard of it. Unless they're referring to things like S3? Are these large corps running literal custom filesystem implementations?
- foota 1y agoNot sure about everyone, but probably yes. Imo the killer feature is durability and replication. You can use single disks if you don't care about data loss, but once you need to start replicating data you need a distributed filesystem. Tectonic is Facebooks, Google's is Colossus. I'm not sure about the others.
- StrangeDoctor 1y agoDeepseek has their own and they’re relatively small https://github.com/deepseek-ai/3FS https://github.com/deepseek-ai/3FS It’s specialized knowledge, hard to do “correctly” (read posix here) but obtainable and implementable by a small team if you pick your battles right. Also supporting very specific use cases helps a lot. It’s also pretty easy to justify as the hardware and software from vanguard tech companies is outrageously expensive. I used to develop software for a blue colored distributed filesystem.
- allset_ 1y agoI can only comment about the one I work for, but yes. It's also discussed publicly to some degree. https://cloud.google.com/blog/products/storage-data-transfer/how-colossus-optimizes-data-placement-for-performance https://cloud.google.com/blog/products/storage-data-transfer...
- loeg 1y agoYes, at least Facebook and Google have distributed file services. (Facebook's was historically based on HDFS, which was based on an old Google paper.)
- mindslight 1y agoIs anyone else bored of seeing the endless line of anti-human-scale distributed filesystems? It's like the engineers building them keep trying to scratch their own itch for a better filesystem that could enable seamless cross-device usage, collaboration, etc. But the engineers only get paid if they express themselves in terms of corporate desires, and corpos aren't looking to pay them to solve those hard problems. So they solve the horizontal scaling problem for the thousandth time, but only end up creating things that requires a full time engineer (or perhaps even a whole team) to use. Hooray, another centralizing "distributed" filesystem.
- 771753 1y ago10000000000B أبي خشب وحديد درع الفضاء سراح الفضاء
- Balinares 1y agoThis is a ridiculously valuable piece of tech to be open sourcing, wow. My thanks to whoever fought that battle and made this happen.
- rostayob 1y agoThere was no battle actually, everybody (well, my boss and my boss's boss) was very supportive of open sourcing. And thanks for the kind words!
- rob_c 1y agoOr there's https://cvmfs.readthedocs.io/en/stable/ https://cvmfs.readthedocs.io/en/stable/
- maknee 1y agoGreat to see another distributed file system open sourced! It has some interesting design decisions. Have a couple of questions: - How do you go about benchmarking throughput / latency of such a system? Curious if it's different compared to how other distributed filesystems benchmark their systems. - Is network or storage the bottleneck for nodes (at least for throughput)? - From my observations from RDMA-based distributed filesystems, network seems to be the case. - How does the system respond to rand / seq + reads / writes? A lot of systems struggle to scale writes. Does this matter for what workload TernFS is designed for? - Very very interesting to go down the path of writing a kernel module instead of using FUSE or writing a native client in userspace (referring to 3FS [1]) - Any crashes in production? And how do you go about tracking it down? - What's the difference in performance between using the kernel module versus using FUSE? [1] https://github.com/deepseek-ai/3FS/blob/main/docs/design_notes.md https://github.com/deepseek-ai/3FS/blob/main/docs/design_not...