What pianogabe wrote is truth, but it's '2nd level of initiation'
I would start with checking basic stuff like:
- audio driver used (is it ASIO if you use extrenal audio interface or WASAPI in case of PC built-in soundcard)
- sample rate (provided in Hz)
- sample buffer/buffer size
You can calculate your latency thanks to math: buffer size/sample rate in kHz.
- sample rate 44.1kHz, buffer size 128: 128/44.1 = ~2.9ms of latency
- sample rate 48kHz, buffer size 256: 256/48 = ~5.33ms of latency
Of course that's just theoretical, because soundcard drivers by themselves intruduce additional latency (usually minimal). As long as you're having something like: 44.1/48kHz and 128 buffer or the multiplies of those you should be good and don't percieve any latency.
There is another variable though. Piano VIs differ one from another and in some cases they introduce additional latency. Even how the sample was recorded matters (eg. if it has long 'pre-attack') it might give a feeling of disconnection (Embertone Walker 1955).