# Record Size Limit in Memory Mode

**URL:** <https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159>\
**Category:** General Discussion\
**Created:** [May 15, 2017, 11:25am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159 "2017-05-15T11:25:08Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arpit\_Wanchoo](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Arpit\_Wanchoo](https://discuss.aerospike.com/u/Arpit_Wanchoo)\
**Post date:** [May 15, 2017, 11:25am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/1 "2017-05-15T11:25:08Z")

</div>

Is there any limit to record size with data in memory mode ? What if data is stored in ram as well as disk ?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [May 15, 2017, 4:29pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/2 "2017-05-15T16:29:34Z")

</div>

Record size limit comes from write-block-size (1 Mb max, including all overhead) which applies to persistent storage, raw blocks on SSD or file based storage on HDD. If you store records purely in RAM then you are limited only by the various buffers in the food chain from client to Aerospike. If you do storage on disk with data in memory also, the 1MB limitation will apply.

---

<div class="post-metadata">

**Author:** ![Arpit\_Wanchoo](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Arpit\_Wanchoo](https://discuss.aerospike.com/u/Arpit_Wanchoo)\
**Post date:** [May 15, 2017, 11:44pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/3 "2017-05-15T23:44:04Z")

</div>

I also observed that with data in memory mode as the size of a map object increases, write into map(insert/update) slows down. I was not expecting this with data in memory mode. What can be the reason for this ?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [May 18, 2017, 7:13am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/4 "2017-05-18T07:13:38Z")

</div>

any update is full rewrite. so with map type bin, if you are inserting new key-value pairs in the map, entire record has to be re-written to a new location. there is no in-situ modification. entire record is stored contiguously in memory.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [May 18, 2017, 6:19pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/5 "2017-05-18T18:19:46Z")

</div>

> [@Arpit\_Wanchoo](#):
>
> I was not expecting this with data in memory mode.

1. Is this [storage-engine memory](http://www.aerospike.com/docs/reference/configuration#storage-engine) or [storage-engine device](http://www.aerospike.com/docs/reference/configuration#storage-engine) with [data-in-memory true](http://www.aerospike.com/docs/reference/configuration#data-in-memory)?
2. What is the replication factor for the namespace?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [May 18, 2017, 9:04pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/6 "2017-05-18T21:04:25Z")

</div>

I think prior to 3.8.3 sorted maps, maps were serialized using msg\_pack. [Storage space difference between bins and maps](https://discuss.aerospike.com/t/storage-space-difference-between-bins-and-maps/725) - i think they are still serialized with msg\_pack but added info is added for key/index based sorting. Since msg\_pack offers compaction, I would think any change will be a full rewrite regardless of storage being memory or disk. So I would think it is a full rewrite - but perhaps kporter may shed more light on the topic.

---

<div class="post-metadata">

**Author:** ![xorphox](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/xorphox/32/633_2.png) [@xorphox](https://discuss.aerospike.com/u/xorphox)\
**Post date:** [May 19, 2017, 10:16pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/7 "2017-05-19T22:16:52Z")

</div>

[http://www.aerospike.com/docs/guide/cdt-map.html](http://www.aerospike.com/docs/guide/cdt-map.html)

You are doing add() operations. Refer to the performance table in the map documentation (link above). Your performance is likely dominated by O(N) for unsorted map types and O(log N) for sorted.

There are a number of O(1) operations in the table. Those are still affected by the record size because “Every modify op has a +C for copy on write for allowing rollback on failure.” memcpy performance should scale linearly with size, but it is orders of magnitude smaller than the map traversing operations performance.

---

<div class="post-metadata">

**Author:** ![Arpit\_Wanchoo](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Arpit\_Wanchoo](https://discuss.aerospike.com/u/Arpit_Wanchoo)\
**Post date:** [May 20, 2017, 3:48am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/8 "2017-05-20T03:48:48Z")

</div>

I am referring to storage-engine memory only. Replication factor is 2.

Basically I am trying to compare this with hset of redis where hset can be as big as 100MB to 1GB. Can such a record be kept as single record (map) in aerospike with similar performance or it is not feasible for such type of records ?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [October 14, 2017, 5:54am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/9 "2017-10-14T05:54:04Z")

</div>

Strictly speaking …100MB yes, 1 GB No.

---

<div class="post-metadata">

**Author:** ![Shubham\_Singh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/shubham_singh/32/1116_2.png) [@Shubham\_Singh](https://discuss.aerospike.com/u/Shubham_Singh)\
**Post date:** [January 11, 2019, 6:39am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/10 "2019-01-11T06:39:09Z")

</div>

Unable to insert data greater than 10 MB per record in the Aerospike `storage-engine memory`, to my understanding, there isn’t a record size limit when using `storage-engine memory`.

Is this limitation is specific to any version if there? Currently I’m using Aerospike v3.11. I’m also using the aerospike PHP client.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 16, 2019, 7:00pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/11 "2019-01-16T19:00:25Z")

</div>

Which version of the PHP client are you using?

Also could you share the error returned by the client?

And anything you could tell us about the record you are storing could be useful as well.

---

<div class="post-metadata">

**Author:** ![Shubham\_Singh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/shubham_singh/32/1116_2.png) [@Shubham\_Singh](https://discuss.aerospike.com/u/Shubham_Singh)\
**Post date:** [January 17, 2019, 6:00am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/12 "2019-01-17T06:00:57Z")

</div>

PHP version is 5.3.29. Error message:- Currently one of the tenants have breached the 10MB limit per record in aerospike cache. its a json record which consists of some data and it is stored as key value pair. Is there any “maxbuffersize” variable is there in php version because this resolve the issue for me in aerospike go client??

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 17, 2019, 10:39pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/13 "2019-01-17T22:39:04Z")

</div>

Your PHP version is older than what our current PHP client supports, so you must be on our much older PHP client. I’m not sure if it had such a restriction but I would suggest testing on a the newer PHP client to see if the issue exists there as well.

---

<div class="post-metadata">

**Author:** ![Arpit\_Maiya](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/arpit_maiya/32/1105_2.png) [@Arpit\_Maiya](https://discuss.aerospike.com/u/Arpit_Maiya)\
**Post date:** [July 5, 2019, 9:40am UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/14 "2019-07-05T09:40:10Z")

</div>

one query regarding memory, how many key value pairs are allowed in aerospike maps? I mean is there any hard limit for adding pairs in maps ?

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 28, 2022, 7:34pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/15 "2022-01-28T19:34:19Z")

</div>

No hard limit - it will be limited by the max record size.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 28, 2022, 7:36pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/16 "2022-01-28T19:36:07Z")

</div>

The [`max-record-size`](https://docs.aerospike.com/reference/configuration#max-record-size) configuration was added in Aerospike 5.7. This will not only allow you to set a size limit when in-memory but also set a limit independent of the `write-block-size` when using persistence.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/system/32/2274_2.png) [@system](https://discuss.aerospike.com/u/system)\
**Post date:** [April 22, 2022, 7:36pm UTC](https://discuss.aerospike.com/t/record-size-limit-in-memory-mode/4159/17 "2022-04-22T19:36:53Z")

</div>

Closed on April 22, 2022, 7:36pm UTC

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.
