If you don't want item duping, then you have all actual item interactions take place on the server, then sync the client to the latest server state whenever it changes.
If you sync the inventory on login and logout you're asking for all kinds of item dupe bugs/exploits. The *only* place to reliably pick up/drop/discard/trade an item is a transaction on the server.
Of course I will make the server able to control everything to avoid this kind of issues and cheating
If you are worried about server crashes then you can also update the database once every x minutes/hours or whenever nothing changed in the inventory for a minute or so.
Yes, for sure I will update the database every X minutes, 30 for example