Lag spikes in Dota 2 have been a problem since the beginning. Though the game has been optimized and improved a lot since then, but there are still random instances of disconnections, high ping and lag spikes that plague the game.

There can be many reasons that can cause your Dota 2 to lag and disconnect. Let's have a look at some the main reasons why this happens and how to fix Dota 2 lag spikes. There are two broad reasons behind the high ping issues and they can be identified as follows.

1) Hardware Issues.
2) Software Issues.
3) Network Issues.

1) Hardware Issue:
These are fairly easy to detect, if you know what you are looking for, and fix. First check the recommended requirements for running Dota 2 from the official Dota 2 website or the game's Steam page. If you don't meet the requirements then that's the first thing to fix.

Then make sure you are on a wired Ethernet connection and not on WiFi. I know it sounds simple but being on a wired connections improves your ping. If you are already on a wired connection, then check for lose cables and bent wires.

2) Software Issues:
You can be experiencing lag spike due to the in efficiency of the Dota 2 installation. Disk Defragmentation not only helps you out by clearing out free space in your hard drive but also it can pull together all the fragmented pieces of the game files and store them more efficiently for the client to read.

Every time the game crashes it creates a dump file in the Dota 2 folder. If your game crashes a lot then there might be hundreds of MBs worth of space eaten up by these files. Go to the steam>steamapps>common>dota2 folder and delete all the .mdmp files in the folder.

You can also try reinstalling the game to a drive other than your windows drive. This improves the game specially for those with smaller windows drive.

If you are running any anti-virus software and experiencing high ping and lag spikes in Dota 2 then try turning off the anti-virus for a few games and see if that improves your game.

3) Network Issues:
First there are the server side issues which you can do nothing about. The devs have to optimize their servers themselves and Valve have been doing a good job at this.

Then the problem can be on you side as well or rather your ISP. The more hops there are between you and the game's servers, the higher the ping you will get. So the routing of your internet provider matters a lot. Unfortunately that route is set and does not change. Your only two options in this situation are either change your internet provider or subscribe to a ping enhancing service like Haste, Kill Ping, Out Fox etc.

Changing ISP is not always feasible for everyone and even changing does not guarantee improvement in your ping times. And as far as the ping enhancers are concerned you can check out the free trials for the services mentioned above and see which one works for you.

For more workarounds you can check this detailed guide of fixes to Dota 2 lag spikes and high ping issues.