A time ticket must be purchased in advance. Security lines can be long too. We have heard reports of well over an hour at peak times. Your visit to the palace interior takes around an hour and a half and you could easily spend another 2 hours exploring the gardens and summer palaces.