ALWAYS use up ALL your resources before you log off. Use them to fill up all the spaces in your wall, like Towers. Then once the wall spaces are maxxed, upgrade the wall to the next level. If all your wall spaces are maxed, and if you are waiting for the Wall upgrade to finish...then train as many archers as you can with your remaining resources. If you run out of population for the troops, use Population Raising Comforting in the Town Hall to get more to use. If you run out of any resource, and have extras of another...sell some of the extra on the market and buy whats low with the gold you make and repeat the above steps. Keep in mind, the above are the last steps you go through before you log off. Give yourself 30-45 minutes to do them.
I should add, that this works best in the starting and middle stages. Has to be modified a little once you reach 150k prestige or so. For example, your food production might eventually be negative from your troops eating everything in sight. So, you will need to keep enough food on hand to last till you log in again.