Check your specific airlines advice but in general you should arrive 3 hours before an international flight or 2 hours before a domestic flight. SFO security line waits scores pretty well for a large US airport in terms of efficiency and layout and arriving 2 or 3 hours early might mean you have some to time to kill but better safe than sorry. Coming from Fishermans Warf and from some other places in the Bay area might take some time as traffic can be slow.
You can view the open lanes for TSA PreCheck at the SFO terminals by looking at the table above.
For information on joining TSA PreCheck and reducing your SFO security wait times visit https://www.tsa.gov/precheck.
International arrivals will all process through the International Terminal at SFO. Consequently, busy periods will mean an awful lot of people trying to get through security at the same time. This means SFO wait times for arriving non-US citizens can be slow and for those with connecting flights, this should be a consideration when booking flights. That said SFO is known to be fairly passenger-friendly, well laid out and efficient for a large airport and it can be possible to get through lines and be on your way in good time.
For further information about, TSA, carry on bag screening, dining and security at SFO visit https://www.flysfo.com/