  Metagenomics has led to significant advances in many fields. Metagenomic
analysis commonly involves the key tasks of determining the species present in
a sample and their relative abundances. These tasks require searching large
metagenomic databases. Metagenomic analysis suffers from significant data
movement overhead due to moving large amounts of low-reuse data from the
storage system. In-storage processing can be a fundamental solution for
reducing this overhead. However, designing an in-storage processing system for
metagenomics is challenging because existing approaches to metagenomic analysis
cannot be directly implemented in storage effectively due to the hardware
limitations of modern SSDs. We propose MegIS, the first in-storage processing
system designed to significantly reduce the data movement overhead of the
end-to-end metagenomic analysis pipeline. MegIS is enabled by our lightweight
design that effectively leverages and orchestrates processing inside and
outside the storage system. We address in-storage processing challenges for
metagenomics via specialized and efficient 1) task partitioning, 2)
data/computation flow coordination, 3) storage technology-aware algorithmic
optimizations, 4) data mapping, and 5) lightweight in-storage accelerators.
MegIS's design is flexible, capable of supporting different types of
metagenomic input datasets, and can be integrated into various metagenomic
analysis pipelines. Our evaluation shows that MegIS outperforms the
state-of-the-art performance- and accuracy-optimized software metagenomic tools
by 2.7$\times$-37.2$\times$ and 6.9$\times$-100.2$\times$, respectively, while
matching the accuracy of the accuracy-optimized tool. MegIS achieves
1.5$\times$-5.1$\times$ speedup compared to the state-of-the-art metagenomic
hardware-accelerated (using processing-in-memory) tool, while achieving
significantly higher accuracy.
