Vitamin D is one of the fat soluble vitamins (along with vitamins A, E, and K). The US RDA for vitamin D is 400IU (international units) per day. As with most RDA levels, this is the amount that is necessary to prevent obvious signs of deficiency including rickets. New European standards have the recommended allowance for adults as 4000IU, ten times higher than the US standard.
For fighting disease, amounts as high as 50,000 IU might be recommended but note that large amounts of vitamin D should not be used long term without blood testing to ensure the level is not excessive. When using vitamin D long term it is necessary to consume sufficient amounts of vitamin K by eating plenty of leafy green vegetables or using a vitamin K supplement since without it, vitamin D can lead to calcium deposits in the body, including in the organs.
Also note that one can get plenty of vitamin D, as much as 100,000 IU per day or more, from sunlight on the skin. This can't be through glass or other filter, but not much is required for therapeutic levels of 5000 IU or more - 15 to 30 minutes per day, more or less depending on the brightness of the sun at that location is usually all that is required. In higher latitudes, it is often beneficial to supplement vitamin D, especially in winter months, or whenever one does not expose themselves to sunlight on the skin. Using sunscreen does indeed limit the amount of vitamin D produced by the skin.
There are a large number of vitamin D supplements. The most important thing to remember is to use vitamin D3 (cholecalciferol), NOT vitamin D2 (ergocalciferol), Of course, D2 would only be included in poorly formulated supplements, such as those recommended by doctors, not by any reputable nutritional supplement manufacturer. A recent study showed that using a D2 supplement actually increases mortality. It is probably in the same manner that using the incorrect form of vitamin E can also increase mortality rates, by inhibiting absorption of the usable form.
Another caution regarding using any form of vitamin D is that sufficient vitamin K should be consumed, too, to prevent possible side effects. This can be done by eating green leafy vegetables (which includes brocolli) twice or more per week, or considering using a vitamin K supplement. Vitamin K-dependent proteins in the body act as potent inhibitors of vascular calcification. So adequate vitamin K will help to ensure calcium ends up in bone where it belongs, instead of calcifying various soft tissues.
If I had a serious illness like cancer, I would immediately find some 5000IU vitamin D capsules and use 5 per day for one week, followed by one per day until I got my Hydroxy D levels checked (see chart below). For preventing illness, it is probably sufficient to use one 5000IU gelcap per day. As stated above, as long as one lives in a sunny climate and gets sufficient exposure, vitamin D supplementation should not be necessary, but it is quite helpful to use a good supplement when sunlight exposure is limited.