[Cppcms-users] Slow http:file copy_stream for big files
Brought to you by:
artyom-beilis
|
From: Cristian O. <one...@gm...> - 2014-10-20 11:07:04
|
Hi, I'm using a simplified version (no widgets::file only request::files) of the uploader [1] to implement an upload service. What I observed is that uploading large files takes a lot of CPU and takes way more than a similar nodejs service [2] (1 min vs 1 s for the same file - 300 MB). I have to admit that this was cppcms compiled in debug against a release nodejs but the difference is too great. Intrigued by this finding I've took a glimpse at how the file is saved to the temporary location using the input stream and found [3]. Reading from the input stream in 1024 byte chunks then writing that to the output does not seem such a great idea and could explain the high CPU usage and the overall slowness. Shouldn't this perform better? out << in.rdbuf(); I promise I'll get back with the results of running a release build. Regards, Cristian [1] http://cppcms.com/cppcms_ref/latest/ex_uploads____uploader__cpp.html [2] https://github.com/felixge/node-formidable [3] http://sourceforge.net/p/cppcms/code/HEAD/tree/framework/trunk/src/http_file.cpp#l78 |