03-20-2013
I suppose if you have a 100% read only and final file set, you could write or find a specialized web server that accepted only dumb GET and pulls the files from preestablished mmap64() areas looked up in a hash map. The overhead would be very low. It could be a thread per socket app, writing with blocking I/O, with the write socket buffers all set to 1-2 pages to keep wired RAM use down.
I suppose that when a file needs to be changed, and migh be a different size, you would need to do that that and not interrupt service. The old file could be deleted, the new file copied, a new mmap made, the new location and size updated into the hash map and when all old transmissions of that file end, the old space unmapped. When you optimize for static, change is a pain!
10 More Discussions You Might Find Interesting
1. IP Networking
I have two machines on my network - one OSX mac and one linux box. The mac is my main workhorse, and the linux box does occasional chores and webserving. Currently the mac shares (via NFS) files with the Liinux box.
Would it be less demanding on the mac if I made it a client, and moved my files... (2 Replies)
Discussion started by: mistafeesh
2 Replies
2. Linux
Hello,
I am ltrying to find the config file to modify a parameter for apache (I guess). Here, when sending mail using php web form I get a copy of all mail sent from that form, but here is a sample of what I get :
From : apache@localhost.localdomain
To : myemail@host.com
Subject : Mail ... (2 Replies)
Discussion started by: qfwfq
2 Replies
3. UNIX for Advanced & Expert Users
hello guys,
this morning when I start my pc (gentoo) I get some strange errors about localhost.
"Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName" ... Apache
the same for my aplications, I have to use the full address of my pc instead of... (1 Reply)
Discussion started by: georgeplus
1 Replies
4. UNIX for Advanced & Expert Users
i am on win 2000 reomting into aix unix server, i need to copy a file from
/tmp to my win 200 desktop, can anyone help with the command i need to use.
also, if a want to view a file in this directory how do i open it? (3 Replies)
Discussion started by: hassanj
3 Replies
5. Solaris
The localhost-access.log has a size 3gb. What can apache2 break log on the parts 300mb, or the other issue, make log every week and index it with prifix current date(localhost-access_date.log)?
Please help. (3 Replies)
Discussion started by: sotich82
3 Replies
6. UNIX for Dummies Questions & Answers
Hello!
I have got next issue: my website is not showing up .gif and .jpg images, but by the direct links (ex. http://somedomain.com/img/logo.gif) i can view them without any problem.
Also if any image is clicked from http://somedomain.com/img/ URL , i get error:
Forbidden
You don't have... (2 Replies)
Discussion started by: v1xon
2 Replies
7. Shell Programming and Scripting
Hi,
I have problem in writing the UNIX scripts,I have one SAP server and my local server .I want to take one file from SAP server to my local server weekly bases I want to write one UNIX scripts which will automatically takes that file from SAP server to my server.so I need not need to pull the... (1 Reply)
Discussion started by: Mohsin22021987
1 Replies
8. Shell Programming and Scripting
Ultimately, I'm looking to create a script that allows me to plug in a usb drive with lots of jpegs on it & copy them over to a folder on my hard drive. So in the process of copying I am looking to hash check them, record dupes to a file, copy only 1 of the identical files (if it doesn't exsist... (1 Reply)
Discussion started by: JonaQuinn
1 Replies
9. Debian
I am getting the message - waiting for localhost.
Here are some diagnostic steps I have tried ....
root@meow:/home/ethan# cat /var/www/cgi-bin/httpd.conf
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/jkj
ServerName 127.0.0.1:80
Listen xx.xx.xx.xx:80
Listen 127.0.0.1:80
... (1 Reply)
Discussion started by: Meow613
1 Replies
10. AIX
need to confirm:
we have a system with two VIOs each serving a partition on a local disk to a client LPAR. That client LPAR has them both in a VG which is mirrored (exact). So each disk has a copy of the client LV that the client VG supports. This is the setup that was bequeathed to us by the... (3 Replies)
Discussion started by: maraixadm
3 Replies
LEARN ABOUT LINUX
sendfile
SENDFILE(2) Linux Programmer's Manual SENDFILE(2)
NAME
sendfile - transfer data between file descriptors
SYNOPSIS
#include <sys/sendfile.h>
ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
DESCRIPTION
sendfile() copies data between one file descriptor and another. Because this copying is done within the kernel, sendfile() is more effi-
cient than the combination of read(2) and write(2), which would require transferring data to and from user space.
in_fd should be a file descriptor opened for reading and out_fd should be a descriptor opened for writing.
If offset is not NULL, then it points to a variable holding the file offset from which sendfile() will start reading data from in_fd. When
sendfile() returns, this variable will be set to the offset of the byte following the last byte that was read. If offset is not NULL, then
sendfile() does not modify the current file offset of in_fd; otherwise the current file offset is adjusted to reflect the number of bytes
read from in_fd.
If offset is NULL, then data will be read from in_fd starting at the current file offset, and the file offset will be updated by the call.
count is the number of bytes to copy between the file descriptors.
Presently (Linux 2.6.9): in_fd, must correspond to a file which supports mmap(2)-like operations (i.e., it cannot be a socket); and out_fd
must refer to a socket.
Applications may wish to fall back to read(2)/write(2) in the case where sendfile() fails with EINVAL or ENOSYS.
RETURN VALUE
If the transfer was successful, the number of bytes written to out_fd is returned. On error, -1 is returned, and errno is set appropri-
ately.
ERRORS
EAGAIN Nonblocking I/O has been selected using O_NONBLOCK and the write would block.
EBADF The input file was not opened for reading or the output file was not opened for writing.
EFAULT Bad address.
EINVAL Descriptor is not valid or locked, or an mmap(2)-like operation is not available for in_fd.
EIO Unspecified error while reading from in_fd.
ENOMEM Insufficient memory to read from in_fd.
VERSIONS
sendfile() is a new feature in Linux 2.2. The include file <sys/sendfile.h> is present since glibc 2.1.
CONFORMING TO
Not specified in POSIX.1-2001, or other standards.
Other Unix systems implement sendfile() with different semantics and prototypes. It should not be used in portable programs.
NOTES
If you plan to use sendfile() for sending files to a TCP socket, but need to send some header data in front of the file contents, you will
find it useful to employ the TCP_CORK option, described in tcp(7), to minimize the number of packets and to tune performance.
In Linux 2.4 and earlier, out_fd could refer to a regular file, and sendfile() changed the current offset of that file.
SEE ALSO
mmap(2), open(2), socket(2), splice(2)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-02-15 SENDFILE(2)