That's a question you and your orthopedic surgeon will have to answer together. But when knee pain is so bad it actually interferes with the things you want or need to do, the time may be right.
Knee replacement may be an option when nonsurgical interventions such as medication, physical therapy, and the use of a cane or other walking aid no longer help alleviate the pain. Other possible signs include aching in the joint, followed by periods of relative relief; pain after extensive use; loss of mobility; joint stiffness after periods of inactivity or rest; and/or pain that seems to increase in humid weather.
Your primary-care doctor may refer you to an orthopedic surgeon who will help you determine when/if it's time for knee surgery and which type of knee surgery is most appropriate. Your surgeon may decide that knee replacement surgery is not appropriate if you have an infection, do not have enough bone, or the bone is not strong enough to support an artificial knee.
Doctors generally try to delay total knee replacement for as long as possible in favor of less invasive treatments. With that being said, if you have advanced joint disease, knee replacement may offer the chance for relief from pain and a return to normal activities.