Getting things humming on a 4 gig server

Will soon be migrating from a 2 gig CentOS server to a 4 Gig Ubuntu.
We’ll be running nginx (of course), php-fpm, the fastcgi cache, MariaDB
and Zend Opcache.

Though I realize that 4 gigs of RAM is still modest, it is twice what
we’ve previously had. I’m just curious for some general suggestions (or
pointers to articles) as how to allocate 4 gigs between php-fpm, the
opcache, the fastcgi cache and DB caches.

Would appreciate any tips or pointers.