Anaerobic digestion is the most successful bioenergy technology worldwide with, at its core, undefined microbial communities that have poorly understood dynamics. Here, we investigated the relationships of bacterial community structure (>400,000 16S rRNA gene sequences for 112 samples) with function (i.e., bioreactor performance) and environment (i.e., operating conditions) in a yearlong monthly time series of nine full-scale bioreactor facilities treating brewery wastewater (>20,000 measurements). Each of the nine facilities had a unique community structure with an unprecedented level of stability. Using machine learning, we identified a small subset of operational taxonomic units (OTUs; 145 out of 4,962), which predicted the location of the facility of origin for almost every sample (96.4% accuracy). Of these 145 OTUs, syntrophic bacteria were systematically overrepresented, demonstrating that syntrophs rebounded following disturbances. This indicates that resilience, rather than dynamic competition, played an important role in maintaining the necessary syntrophic populations. In addition, we explained the observed phylogenetic differences between all samples on the basis of a subset of environmental gradients (using constrained ordination) and found stronger relationships between community structure and its function rather than its environment. These relationships were strongest for two performance variables-methanogenic activity and substrate removal efficiency-both of which were also affected by microbial ecology because these variables were correlated with community evenness (at any given time) and variability in phylogenetic structure (over time), respectively. Thus, we quantified relationships between community structure and function, which opens the door to engineer communities with superior functions.T he production of bioenergy from wastes is an essential component in the global development of sustainable energy sources (1). Anaerobic digestion, which is the most prominent bioenergy technology worldwide, uses undefined microbial cultures to produce methane from organic substrates (2). Methanogenic bioreactors are maintained on the basis of decades of observed relationships between performance and operating parameters. However, differences underlying bioreactors that perform well and bioreactors that perform inadequately are often poorly understood (3). This has led to a general perception that methanogenic bioreactors are unreliable or unstable, inhibiting their wider adoption for bioenergy production (2). A deeper analysis of the structure and dynamics of bioreactor microbial communities as a function of performance and operating conditions has the potential to reveal important and unappreciated structure-function relationships.The efficient and stable operation of methanogenic bioreactors relies on syntrophic relationships among a community of microbes, including fermenting bacteria, specialized acidogenic and acetogenic syntrophs, and methanogenic archaea (4), with diverse and parallel pathways for...