Okay, then if it is not related to RAM, what is it related to? I'd like some help.
I had the same issue (a lot of beachballs mainly on Safari). But, I have MacBook Pro 13" (Mid 2010), not MacBook Air. I had this issue, since the first version of Yosemite. I even downgraded from Yosemite to Mavericks. I still had beachballs but was less then Yosemite. I read in this forum that to do clean install of Yosemite, which I did. For a week, I did not get any beachballs after clean install. After one week, I started getting beachballs again. By the way, I also upgraded my MBP 's RAM to 8GB and HDD to SSD last year. I started thinking, my MBP is not fully capable of running Yosemite. I even bought Scannerz app to check if there was something wrong with my SSD, and also this app also checks if SSD cable is faulty or not. Anyway, all tests passed.
By the way how much RAM, you have ?
What version of Yosemite you have ?
Now, I get beachballs occasionally, nothing like before.
What helped me:
1. On System Preferences click General and at bottom, check "Close windows when quitting an app".
2. I did clean install of Yosemite 10.10.4 (latest version), and migrating data manually.
3. Checking the Memory Pressure graph on Activity Monitor. When I see graph getting thicker green and yellow,
during that time, I usually have few GBs of "Compressed Memory". When this happens, Performance of my
Mac degrades. And I start getting beachballs.
4. I also shut down my Mac every night. And boot again every morning. This cleans the memory every day.
This does not mean, all these things will definitely help you. I just shared what helped me.
T.O.
P.S. When, I was getting alot of beachballs, I started using Chrome browser, with Chrome I was not getting any beachballs at all. But I like Safari much more then Chrome.