Many chemical reactions in various natural and technological processes occur in cavities containing a small number of molecules. Examples include reactions in enzymatic fuel cells, nanoreactors, and nanopores, 1,2 drug delivery devices, 3 cells and cellular subdomains, and 4,5 micelles and bubbles 6,7 to mention just a few. One of the distinctive features of reactions in cavities is the important role of fluctuations. 8,9 Therefore, the description of the reaction kinetics in terms of the rate equations for the concentrations should be used with care. The present paper reports on the results of a Brownian dynamics simulation study of the simplest reaction in a cavity: diffusion-limited annihilation of two spherical particles of radius b occurring at their first contact. This reaction is studied in spherical and cubic cavities of the same volume over a wide range of the cavity size. The analysis is performed for three cases: (1) both particles diffuse with the same diffusivity, denoted by D, (2) one particle is fixed at the center of the cavity, and the second diffuses with doubled diffusivity, 2D, that guarantees the same relative diffusivity of the reaction partners, (3) the same as case (2) with the immobile particle located on the wall of the spherical cavity and at the center of one of the faces of the cubic cavity.