# With ZFS, is ECC memory useless?



## olav (Jun 10, 2010)

I've googled for this, but I could find a good answer. ZFS has self healing with checksums to prevent silent data corruption. Is it necessary to spend extra money on ECC memory? Or is it practically useless in this situation?

For an application server I see the need for ECC memory, but for a pure fileserver?


----------



## graudeejs (Jun 10, 2010)

it depends on your services, that you provide.
If you can afford, possibility, that some bits change in ram (for example price) then you probably can avoid ECC.
If you not afford to lose any bit of information, or, your can't afford to have inadequate memory (for example dealing with a lot of money stuff), then I'd spend more cash for ECC.

EEC is to make sure, that things won't get corrupted in memory. (it's not quite related to ZFS, however zfs also depend on RAM  )


----------



## SirDice (Jun 10, 2010)

Memory management and filesystem management are different things. ECC memory protects against memory corruption. While ZFS only deals with filesystem errors.


----------



## graudeejs (Jun 10, 2010)

SirDice said:
			
		

> Memory management and filesystem management are different things. ECC memory protects against memory corruption. While ZFS only deals with filesystem errors.



however memory corruption, may cause FS problems (at least for some FS), which ZFS should be able to fix, right?


----------



## SirDice (Jun 10, 2010)

killasmurf86 said:
			
		

> however memory corruption, may cause FS problems (at least for some FS), which ZFS should be able to fix, right?



No, ZFS has no idea the data that came from memory is corrupt or not. ZFS only error corrects data that comes from the filesystem.


----------



## graudeejs (Jun 10, 2010)

yes, but metadata and such are stored in memory as well, not only on disk
and all data is in ram, before it's written to disk (so once correct place is corrupted, corruption might get written to disk, and later be fixed (by zfs self-healing))


----------



## SirDice (Jun 10, 2010)

The 'self-healing' properties of ZFS are only on the on-disk structure. Not on it's memory structures.


----------



## graudeejs (Jun 10, 2010)

yes, that's what I'm saying


----------



## SirDice (Jun 10, 2010)

No, you're saying that if corrupted data gets written to disk it will be corrected if it's read back. This is not the case. The corruption occurred before ZFS handles the data. As such it has no idea that data block is corrupted and will write 'bad' data to disk. The data itself is bad but ZFS will accept it as good. It has no way of knowing it was corrupt when it was written to disk. The read will be without problems as the checksums (that where created when the data was written) are good. The data however is not correct.


----------



## graudeejs (Jun 10, 2010)

oh,ok


----------



## olav (Jun 12, 2010)

So the conclusion is, having checksums enabled is only useful if you have ECC memory?


----------



## Beastie (Jun 12, 2010)

Nope, conclusion is: have both checksums and ECC enabled memory, or any possible combination of error prevention/consistency check mechanisms available in software _and_ hardware.


----------



## Carpetsmoker (Jun 12, 2010)

Suppose you calculate a formula (A simple one) In C (Or any other programming language):

```
float pi = 3.14159;
area = pi * radius^2;
```

There is no disk IO here, but the variables _pi_, _area_, and _radius_ are stored in memory.
Do you think that the result of this equation will be the same (i.e. CORRECT!) if a bit of memory changed on one of these variables?


----------

