If using NetworkManager you can turn off power save mode by doing the following:
sudo sed -i 's/wifi.powersave = 3/wifi.powersave = 2/g' /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
If using ifupdown, add the following to the /etc/network/interfaces file
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-power off # <-- turn off power save mode
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf