Follow The CBAN acronym.
Do not remove the ice until you reach Numb!
When it's numb - your done.
Almost everyone prefers heat to ice. If you are going to use heat - use it with ice on a 1-2-1 ratio.
Ice until Numb (usually about 20 minutes)
Heat for 1/2 that amount of time: 10 minute
Ice until numb again (approx 20 minutes)
One of the most important things to remember when icing is to only leave the ice on until the area is numb! If you leave it on for a specified time - and the area is already numb, you may be damaging the tissue and muscle fibers.
ICE is one of the most natural analgesics you can find. In Muscle Therapy - ICE is key to not just relieving pain, but also bringing blood flow and oxygen to muscles.