Key points for Slavery:
1) Food is very important. You are converting your food into production so cities with a good food surplus are going to be able to do this more effectively than cities with a low food surplus.
2) Happiness is also very important. Every time you whip a city you get 1 unhappiness for 10T. If you dont have any sources of +happiness you're cities will quickly become unhappy and less productive. There are alot of ways to get happiness, but some of them can be difficult, expensive, or RNG-based (luxury resources in your starting area). I think Charismatic is a really strong trait for early game whipping, because its incredibly reliable. You get a free +1 from the trait and another +1 simply by building a monument.
The sacrificial altar does help with whip anger by reducing the duration, but sadly they are very expensive to unlock and to build. If you are attempting an early game rush, speed is often the most important factor and Code of Laws is a pretty expensive tech thats going to require a very significant detour. Courthouses are also very expensive buildings that are mostly used in the later stages of the game when you have a larger empire with high expenses. I would not recommend building the altars for any attack before medieval times so this would be Engineering for trebuches along with maceman and such. Knights are also a good addition once you get Guilds.
For any earlier attacks like axes, horse archers, or catapults + war elephants, you definitely want to forgo the altars in favor of attacking much, much earlier.
3) Whip timing is important, and larger whips are more efficient than smaller whips since they always incur +1 unhappiness no matter how many citizens are being whipped away. You want to avoid 1-pop whips as much as possible. Each citizen being whipped provides 30 hammers. If you want to whip a unit that costs 50 hammers to produce, you really want to whip it BEFORE you get 20 hammers into it. Once it gets to 20/50 or more, it will only whip 1 citizen for 30 production. If you whip at 19/50 you will get 60 hammers and end up with some nice overflow. This can allow you to alternate between whips and non-whips. Whip the first unit and then build the next unit using the overflow + standard production or a forest chop.
So the ideal time to do a 2-pop whip is when you are 31 (or reasonably close) hammers away from finishing a build, and for a 3-pop whip its 61, etc. 3-pop whipping a settler around 39/100 is a pretty common early game tactic.
Also, please note that any multipliers to production changes the math for whips. Imperialistic adds a 50% bonus to settler production so a settler whip will be 45 per pop for an IMP leader. Other common early game multipliers are workers for Expansive leaders, forges, and buildings that certain leader traits give a 100% production bonus for.