# Sendfile(2) FreeBSD Netflix



## shahzaib (Mar 2, 2017)

Hi,

Hopes everybody is doing great here. My question was related to newly developed Sendfile(2) by Netflix specifically for Nginx on FreeBSD only. Is this already enabled in all FreeBSD systems or we need to recompile kernel to obtain sendfile(2) feature ? The more read is here :

https://www.nginx.com/blog/nginx-and-netflix-contribute-new-sendfile2-to-freebsd/

Thanks in advance !!


----------



## SirDice (Mar 2, 2017)

If you look at the actual commit message you see it has already been added 13 months ago.

https://svnweb.freebsd.org/base?view=revision&revision=293439

And sendfile(2):

```
HISTORY
     The sendfile() system call first appeared in FreeBSD 3.0.  This manual
     page first appeared in FreeBSD 3.1.  In FreeBSD 10 support for sending
     shared memory descriptors had been introduced.  [b]In FreeBSD 11 a non-
     blocking implementation had been introduced.[/b]

AUTHORS
     The initial implementation of sendfile() system call and this manual page
     were written by David G. Lawrence <dg@dglawrence.com>.  [b]The FreeBSD 11
     implementation was written by Gleb Smirnoff <glebius@FreeBSD.org>.[/b]
```


----------



## shahzaib (Mar 2, 2017)

SirDice Thanks for response. All of our servers are on FreeBSD-10.X release so they are not utilizing sendfile(2) capabilities ? If yes, if we want to upgrade all servers to 11.X release would there be any critical drawback such as Data corruption ? Since each server contains around 10TB of data & its not possible to backup before upgrade.


----------



## SirDice (Mar 2, 2017)

shahzaib said:


> All of our servers are on FreeBSD-10.X release so they are not utilizing sendfile(2) capabilities ?


No, as far as I understood it it's only available on 11.0 or higher. 



> If yes, if we want to upgrade all servers to 11.X release would there be any critical drawback such as Data corruption


Any update or upgrade has an inherent risk. There's no more risk than any other update/upgrade.




> Since each server contains around 10TB of data and its not possible to backup before upgrade.


I hope for your sake you do have backups. Mistakes are easy to make and losing 10 TB of data would be a really bad thing to happen.


----------



## shahzaib (Mar 2, 2017)

SirDice Thanks for explanation. So i guess will have to plan something out for migration & setup new FreeBSD-11 on it.


----------



## shahzaib (Mar 2, 2017)

SirDice i wanted to make another point here. We've installed FreeBSD on dedicated SSD device while our data is on 12x3TB HDDs built upon Raid10. So i guess if upgrading affect any corruption it'll only affect the SSD (where OS is installed) while RAID will be saved ? Please correct me if i am wrong ?


----------



## SirDice (Mar 2, 2017)

shahzaib said:


> So i guess if upgrading affect any corruption it'll only affect the SSD (where OS is installed) while RAID will be saved ?


In all the years I've used FreeBSD (from 3.0 onwards) I've never had a corruption (OS or data) due to an upgrade. But there are no guarantees of course, so always plan for the worst possible.


----------

