filestream

SQL Server 2008 FILESTREAM performance

寵の児 提交于 2019-12-03 07:10:17
问题 I had some questions around the FILESTREAM capability of SQL Server 2008. What would the difference in performance be of returning a file streamed from SQL Server 2008 using the FILESTREAM capability vs. directly accessing the file from a shared directory? If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 second window, would SQL Server 2008 performance slow to a crawl? 回答1: If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 second window,

SQL Server Filestream - Delete “speed”

白昼怎懂夜的黑 提交于 2019-12-03 07:03:29
I'm working with the filestream datatype for the first time (SQL Server 2008) and I'm running into issues when I am doing some fast insert/deletes. Basically the speed at which the files are actually removed from the FileSystem is way slower then the insert/delete speed even if I invoke the garbage collector manually (As far as I know the CHECKPOINT is supposed to invoke the garbage collector). The code below illustrate the problem - It takes roughly 30 seconds to executes, but you have to wait quite a few minutes for the last file to be deleted from the filesystem (When I look up the C:

FileStream with DeleteOnClose File option

孤街浪徒 提交于 2019-12-03 07:03:01
In my project I have to create some temp files in an USB device, which I want to delete on Closing. So I used a code like this.fcommandHandler = new FileStream(TempFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite, 512, FileOptions.DeleteOnClose); It works fine. But the problem is I want to use one more FileOption, like No buffering. private const FileOptions FILE_FLAG_NO_BUFFERING = (FileOptions)0x20000000; this.fcommandHandler = new FileStream(TempFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite, 512, FileOptions.DeleteOnClose & FILE_FLAG_NO

inotify - how to find out which user has modified file?

折月煮酒 提交于 2019-12-03 07:02:56
I'm looking for guidance on how to find out which user has modified a particular file. While inotify is great to get notification when a particular file is touched, how do I figure out which user has modified that file? I can think of using lsof but I'm afraid that it may not be as "realtime" as I want and/or it might be too much of a tax on resources. By realtime, I mean that if a user simply executes a touch command on a file, by the time I run lsof on file, it may not be picked up by lsof . You can use audit deamon : sudo apt-get install auditd Choose a file to monitor touch /tmp/myfile Add

Returning a stream from File.OpenRead()

[亡魂溺海] 提交于 2019-12-03 06:28:20
问题 I'm in the process of writing a WCF service that will allow an ASP.Net web site to retrieve files (based on this article). My problem is that when I return the stream, it's blank. For simplicity, I've isolated the code into a simple winforms app to try and find what the problem is with returning a stream and this is the code: private Stream TestStream() { Stream fs = File.OpenRead(@"c:\testdocument.docx"); return fs; } // This method converts the filestream into a byte array so that when it

Upload a file with encoding using FTP in C#

不羁的心 提交于 2019-12-03 06:13:28
The following code is good for uploading text files, but it fails to upload JPEG files (not completely - the file name is good but the image is corrupted): private void up(string sourceFile, string targetFile) { try { string ftpServerIP = ConfigurationManager.AppSettings["ftpIP"]; string ftpUserID = ConfigurationManager.AppSettings["ftpUser"]; string ftpPassword = ConfigurationManager.AppSettings["ftpPass"]; //string ftpURI = ""; string filename = "ftp://" + ftpServerIP + "//" + targetFile; FtpWebRequest ftpReq = (FtpWebRequest)WebRequest.Create(filename); ftpReq.Method = WebRequestMethods.Ftp

How to force the filestream garbage collector to complete its work with the highest priority?

可紊 提交于 2019-12-03 03:46:53
After asking this question it is clear to me that I need to be able to perform the garbage collection in the fastest possible time. How is it possible to tell SQL Server filestream's garbage collector to delete all the files with high priority? I tried with the CHECKPOINT statement, even by setting a duration (CHECKPOINT 100), but nothing changes. After deleting 40000 filestream records I see that the garbage collector removes 4-5 files per second. How to tell him "delete them all now"? Unfortunately there's currently no way to force garbage collection (GC) of filestream data. It's handled by

C++: What is a stream

前提是你 提交于 2019-12-03 02:59:21
问题 I have been hearing about stream, more specifically file streams. So what are they? Is it something that has a location in the memory? Is it something that contains data? Is it just a connection between a file and an object? Any help would be appreciated 回答1: The term stream is an abstraction of a construct that allows you to send or receive an unknown number of bytes. The metaphor is a stream of water. You take the data as it comes, or send it as needed. Contrast this to an array, for

How to create directories automatically using ofstream [duplicate]

左心房为你撑大大i 提交于 2019-12-03 01:15:10
This question already has answers here : How can I create directory tree in C++/Linux? (15 answers) I am now writing an extractor for a basic virtual file system archive (without compression). My extractor is running into problems when it writes a file to a directory that does not exist. Extract function : void extract(ifstream * ifs, unsigned int offset, unsigned int length, std::string path) { char * file = new char[length]; ifs->seekg(offset); ifs->read(file, length); ofstream ofs(path.c_str(), ios::out|ios::binary); ofs.write(file, length); ofs.close(); cout << patch << ", " << length <<

SQL Server Integrated Security

余生颓废 提交于 2019-12-02 21:51:21
问题 I've been searching hard to get my head around security related issues in a SQL Server. We're developing a .NET application that targets SQL Server 2008 and we want to use FileStream. Now I've found out that SQL Server only allows FileStream through the Win32 API if you use Integrated Security. The problem is that we have around 80% of our application finished, but it is entirely based on SQL Authentication. So we are doing INSERT's straight form our application and are not using Stored