Is is better to use 2 or 4 cpu servers for esx? what are pros/cons?
It's totally down to load.
If you have enough VMs that they would actually utilise four CPUs, then buy them. Such servers are pretty rare at the moment though, with six core dual CPUs become more powerful than say, yesteryear's quad processor dual core systems. You can run an extraordinary amount of VMs on such systems.
I agree with Josh. Are your servers more memory intensive or CPU intensive? What do you have for licensing? Power/heating/cooling?
If you go with a 4 proc box, you have fewer cables and ports, probably less power/heating/cooling because it's all one box. But a host failure will affect potentially more VMs and if you have N+1 cluster, you'll have a much bigger box acting as your +1 capacity.
If you gow ith a 2 proc box, you'll have more cables and ports in use but you gain more HA capacity because it's another server. Plus you don't have as much money tied up in your N+1 capacity.
It's a pretty open ended question that can go either way. My previous employer went for the 4 proc boxes because it was a little cheaper and we needed the horsepower. But now the procs are so far ahead of everything that 2x 6 cores can handle a ton of servers and memory becomes a bottleneck.
This is the critical choice.
A multicore CPU combines multiple independent cores on a single physical CPU; essentially turning a single physical CPU into multiple CPUs. An example of this is a server with two quad-core CPUs that has eight processors available for use. Depending on the CPU brand and model, these cores sometimes share a single cache, or have separate Level 2 caches for each core. Most virtualization software vendors sell licenses by the socket and not by the number of cores that the socket has, so multicore processors are fantastic for virtualization. For new servers, multicore CPUs are now virtually standard.
You also have to decide between dual- and quad-core CPUs. You may be tempted to choose quad-core over dual-core based on an assumption of the more cores, the better. But dual- and quad-core CPUs feature crucial differences. CPU core increases do not follow the same scale as CPU clock-speed increases. A 3.2 GHz CPU is twice as fast as a 1.6 GHz CPU, but a quad-core CPU is not four times faster than a single core. A dual-core CPU is roughly 50% faster than a single-core CPU (not 100%, as you might expect), and a quad-core CPU is only about 25% faster than a dual-core CPU. In addition, dual-core CPUs typically have higher clock speeds than do quad-core CPUs. Quad-core CPUs generate excessive heat and, as a result, cannot be clocked as high as single- and dual-core CPUs.
In general quad-core CPUs are recommended for virtual hosts for two reasons. The first is that most virtualization software is licensed by the number of sockets in a server and not the number of cores you have. This means you get more CPUs per license than you purchase. The second reason is that having more cores in a host server gives the hypervisor CPU scheduler more flexibility when trying to schedule CPU requests that are made by VMs. Having more cores available makes a CPU scheduler's job easier and improves VMs' performance on a host.
In some situations, however, dual-core rather than quad-core CPUs are preferable (if you don't plan on running more then six to eight VMs on hosts, for example). The faster CPU MHz of dual-core hosts increases speed to the VMs running on it. In addition, if you plan on assigning VMs a single virtual processor, dual-core processors can be a better option, because single vCPU VMs are easier for the hypervisor to schedule than multiple vCPU VMs.