AnsweredAssumed Answered

Vardef caching - can it be redis/memcached based?

Question asked by Michael Shadle on Jul 30, 2016
Latest reply on Nov 29, 2016 by Allen Sellars

I am running SugarCRM on top of an ObjectiveFS shared filesystem. It has "okay" performance, but it's not supposed to be treated like a scratch disk for "atomic renames" (file_put_contents() probably takes care of this already...?) - this is going to be the same with any network filesystem (NFS for example)


After taking a couple hours to finally narrow down where the issue was in a setup for a client, I traced it to the sugar_file_put_contents_atomic() function. Anyway, the main abuser of this is include/SugarObjects/VardefManager.php - the saveCache() method.


Is there a drop-in or simple way to replace this filesystem-based cache with something a little bit more scalable and cloud-friendly, like memcached or Redis? There's other caching in SugarCRM I see, but there doesn't seem to be anything for this. It's 2016, we shouldn't be stuck with only a file-based caching system. There shouldn't need to a requirement for file I/O anyway for an expectedly volatile cache scenario... that's exactly what read-through cache layers are for.


Meanwhile a couple hacks to proof of concept gained some performance back to nearly normal:
1) sugar_file_put_contents_atomic() to call file_put_contents() directly

2) changing $dir to /tmp - so the temp files are created on local temp scratch space before the rename


I am not a pro at SugarCRM, so I am not sure how easy it is to just override the Vardef cache methods - I might give it a shot but I don't know the overall impact of this. There's a lot of code to go through. It looks like this is SugarCRM 6.5.23 CE.