Have you ever used After Effects before? A composition must be cached before it can be expected to be played back in real time. Once you have the green line above your whole composition, it should be able to play in real time.
Now, that being said, on 4K and 5K iMacs, there seem to be some bugs that still aren't fixed yet. If you have a fully cached timeline and you're not getting realtime playback, try docking another panel underneath your timeline panel. If that doesn't work, also try to shrink the height of your timeline panel. If that doesn't work, try pressing the ` key (same key on US English keyboards as the ~) with your mouse over the composition panel to make it full screen.