It is advisable to use a persistent database, especially for something like a comment system.
Cookies and localStorage store data that is only visible to a particular browser, and they’re not visible to other users, which is is not something you would want for a comment system. Because in a comment system, you should be able to see comments by everyone and not just yourself (unless you want some self-motivation ). Also, cookies and localStorage can get cleared when you clear your browser cache. Therefore I conclude, cookies and localStorage are not suitable places to store data.