# Why is the \`maxHeaderSize\` 21 and not 22?

**URL:** <https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644>\
**Category:** Badger\
**Tags:** kind:question\
**Created:** [August 11, 2022, 4:30pm UTC](https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644 "2022-08-11T16:30:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liangzheng](https://avatars.discourse-cdn.com/v4/letter/l/65b543/32.png) [@liangzheng](https://discuss.dgraph.io/u/liangzheng)\
**Post date:** [August 11, 2022, 4:30pm UTC](https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644/1 "2022-08-11T16:30:36Z")

</div>

> <https://github.com/dgraph-io/badger/blob/2de177900e3ced14fdab91aa7c6a7e3e441f0192/structs.go#L76>

Why is the `maxHeaderSize` 21 and not 22=5+5+10+1+1?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [August 11, 2022, 6:20pm UTC](https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644/2 "2022-08-11T18:20:42Z")

</div>

Sorry, but no one will be able to address your question in short or mid term. Who kept that part of the code is not 100% available. Maybe he will appear in the future.

cc @ibrahim

---

<div class="post-metadata">

**Author:** ![jarifibrahim](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/jarifibrahim/32/9077_2.png) [@jarifibrahim](https://discuss.dgraph.io/u/jarifibrahim)\
**Post date:** [August 13, 2022, 9:20am UTC](https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644/3 "2022-08-13T09:20:34Z")

</div>

I don’t remember how 21 was calculated but it looks like it should be 22.

Based on [binary package - encoding/binary - Go Packages](https://pkg.go.dev/encoding/binary#pkg-constants)  
We will have

```auto
type header struct {
	klen uint32 // min 1 byte, max 5 bytes
	vlen uint32 // min 1 byte, max 5 bytes
	expiresAt uint64 // min 1 byte, max 10 bytes
	meta byte // min 1 byte, max 1 byte
	userMeta byte // min 1 byte, max 1 byte
}

```

So we get maxHeaderSize=22

---

<div class="post-metadata">

**Author:** ![liangzheng](https://avatars.discourse-cdn.com/v4/letter/l/65b543/32.png) [@liangzheng](https://discuss.dgraph.io/u/liangzheng)\
**Post date:** [August 13, 2022, 2:30pm UTC](https://discuss.dgraph.io/t/why-is-the-maxheadersize-21-and-not-22/17644/4 "2022-08-13T14:30:23Z")

</div>

Yes, I also think the value of `maxHeaderSize` is 22, not 21. Could you help to confirm it? Thanks.
