Usually that can be achieved with a cache like Varnish. One of the biggest benefits of static site generators is that the only software you need on your server is a web server. As soon as you want to start adding things like search and comments, you lose that benefit.
You can use third party tools for both search (e.g. google site search) and comments (e.g. discus). Of course, if you want to customize things further with user-supplied content, at some point you'll need a dynamic backend.