The lifespan of a carpet is about 3-5 years, depending on how much traffic it gets. The primary factors affecting the lifespan of a carpet are the quality of the materials and construction, usage, and environment. It also depends on how well you maintain it.
You can extend its life by taking good care of it.
First of all, vacuum your carpets frequently. Vacuum all the carpet fibres and remove all small particles such as sand or other dirt that may have been collected in the fibres of your carpet.
Clean spills as soon as possible when something is spilled on the carpet because they can permanently discolour a carpet if left unattended for some time.
Don't wear shoes on your carpet, because they'll dirty and discolor it permanently! The soil that you drag into the middle of the fibres will stay there until you clean all-that's-left.
Buy a mat in front of the entrance door so as to prevent dirt to spread to the rest of the room where a carpet is installed.
Keep your carpet clean by washing it with warm water and cleansers at least once or twice a year.
After vacuuming and cleaning it, make sure to leave it out in the sun for air drying. Again, do not walk on it with shoes when you are dry-cleaning your carpets though because soil mixed with cleaning solutions can permanently discolour your carpet and is difficult to remove.