User contribution determines the success of online knowledge communities. As user contributions are voluntary, many online communities failed due to declining user contributions. Hence, it becomes critical to understand and design mechanisms that are effective to motivate user contributions. This paper studies the effects of two mechanisms, virtual rewards and reputation, on the quantity and quality of user contributions in online community. We analyze user-level panel data from a representative knowledge sharing platform Stack Exchange.com, and investigate whether these two mechanisms improve the quantity and quality of user contributions. Surprisingly, we find that a user's reputation does not directly motivate contribution. It is the relative reputation (ranking) that serves as the motivation. This finding highlights the importance of peer effect and social comparison in the incentive design of open collaboration platforms. Our study provides implications for platform designers on how to motivate community participants and build sustainable online knowledge communities.