Minecraft wiki entry for Spawn-proofing, associated text: Mob switch
Minecraft has a mob cap. That mob cap increases by 70 for each player online, unless it is altered through commands. This is to ensure that the world is not flooded with mobs. If you use name tag on a mob, it no longer counts towards the mob cap, but it does not despawn either, i.e it won't disappear if you go away. Some mobs are an exception to this despawn rule, like withers and shulkers. Therefore if you put more than the mob cap of either of these mob in the spawn chunks, you prevent mobs from spawning in the world. If those mobs are put on the edges of the spawn chunks, you can move them in and out (in mine carts), turning it on or off.
Another alternative to the spawn chunks is loading the area with nether portals. This is useful because it allows you to locate the mob switch anywhere in the world.