The distance for mobs to spawn is from 24 to
128 blocks away from any player. Further than that, the mobs don't spawn at all. If you're between 24 and
32 blocks, mobs could spawn and despawn too, probably a memory limit thing. Light level must be lower than 8.
read more >>