I recently integrated a file preview application in our application with team, so now users can preview most of the files without downloading them. The hard part was to deal with NFS issues due to locking and caching. We chose to buy v/s build for the file preview and bought some third party service. The third party service lets call it APreview had a http api where you can pass the source and target file path. It would have been much better if we could stream the input and it could stream the output but that option was not there. Because we can only pass paths to it the natural solution was to use NFS paths. So we ran into two major issues:
1)The APreview application internally uses openoffice to convert word/PPT/Xls files to pdf and then it converts pdf to swf. openoffice has some issues with writing to NFS and we could use vi and other tools to write files but openoffice would just refuse to save the file as pdf. Finally I found that commenting these two lines in /usr/lib64/openoffice.org3/program/soffice made the thing working
#SAL_ENABLE_FILE_LOCKING=1
#export SAL_ENABLE_FILE_LOCKING
you have to comment it out. setting this SAL_ENABLE_FILE_LOCKING=0 wont work and dont forget to comment out the 'export' also.
2) Serving file over NFS had issues because of NFS cache lag. The VM where APreview was installed would write the file on NFS mount but the tomcat that has to serve the file was seeing the file after 15 sec delay. We tried all sort of things and ultimately gave up on NFS to serve the file. We installed apache on the Filer-server where preview were stored and served the file over http using apache reverse proxy.
1)The APreview application internally uses openoffice to convert word/PPT/Xls files to pdf and then it converts pdf to swf. openoffice has some issues with writing to NFS and we could use vi and other tools to write files but openoffice would just refuse to save the file as pdf. Finally I found that commenting these two lines in /usr/lib64/openoffice.org3/program/soffice made the thing working
#SAL_ENABLE_FILE_LOCKING=1
#export SAL_ENABLE_FILE_LOCKING
you have to comment it out. setting this SAL_ENABLE_FILE_LOCKING=0 wont work and dont forget to comment out the 'export' also.
2) Serving file over NFS had issues because of NFS cache lag. The VM where APreview was installed would write the file on NFS mount but the tomcat that has to serve the file was seeing the file after 15 sec delay. We tried all sort of things and ultimately gave up on NFS to serve the file. We installed apache on the Filer-server where preview were stored and served the file over http using apache reverse proxy.
Comments
Post a Comment