Question: how mobs spawn in minecraft?
Answer: Mobs only spawn when the player is nearby, within an area of 240×240 blocks, so you'll need to be close to the farm for it to operate. ... 
Mobs can only spawn on opaque blocks, ruling out the use of glass platforms. ... 
Hostile mobs only spawn at a light level of 7 or less, and the darker the better. (