We’re planning to use the Flexmonster Data Server DLL to process large datasets, deployed within an ECS container.
The AWS team has asked whether Flexmonster supports horizontal and/or vertical scaling. If scaling is supported, do we need to make any changes to our build or configuration, or will the server adapt automatically to additional resources or instances?
Additionally, what is the recommended memory allocation to efficiently handle a dataset of ~600MB, containing 40 columns and approximately 600,000 rows?
Hello Varun,
Thank you for reaching out to us.
Flexmonster Data Server DLL can be horizontally scaled across multiple containers with one instance of the Data Server per container. The requests are independent of the server state, allowing requests from a single pivot to be sent to different servers with the same index loaded.
As for the memory allocation, the Data Server typically requires from 2 to 3 times the amount of RAM compared to the original dataset size. However, this number may vary depending on the data structure, cardinality of values in columns, and volume of cached responses. Also, the memory usage may spike on index reload when the KeepDataOnRefresh option is enabled. We recommend testing the performance with your data to get more specific details on memory allocation.
Please let us know if more questions arise.
Best regards,
Maksym
Hi,
Our infrastructure team has configured the service with containers having 4 CPUs and 16 GB RAM, along with horizontal autoscaling. The autoscaling rules are set to:
Scale up when resource usage reaches 90%
Scale down when usage drops below 25%
Minimum containers: 1
Maximum containers: 5
We expect to have approximately 10–15 indexes, each containing up to 1 million records.
Could you please confirm whether this setup is adequate for the expected load? Additionally, please confirm that user sessions will not be lost when new containers are initialized or existing containers are terminated during scaling events.
Thanks,
Varun
Hi, Varun,
Thank you for sharing these infrastructure details with us.
Our team prepared some recommendations based on the provided autoscaling setup overview.
Autoscaling rules
Your autoscaling rules (scale up at 90%, down at 25%, min 1 / max 5) are generally reasonable, if executed based on the CPU usage. The RAM usage in FDS is relatively constant once the data is fetched. Scaling up at peak usage can work to improve performance, but please note that initializing a new FDS instance can take a long time, since data for indexes must be loaded into RAM.
RAM measurements
FDS stores indexes in RAM, and each running instance holds its own copy of the data. Therefore, each of your containers must have enough RAM to hold all the indexes it serves. With 10-15 indexes and up to 1M records each, 16 GB may not be sufficient to store all indexes in a single instance. However, this strongly depends on the number of fields, their types, and the size of their contents.
For simpler management, we recommend running a single FDS instance per container with all required indexes loaded. Later, if you identify that some indexes are accessed significantly more frequently, you can scale selectively around those.
Session persistence
FDS uses a stateless protocol, so it is not an issue if user requests are handled by different FDS instances. User sessions will not be lost due to scaling, provided that at least 1 copy of the queried index is always loaded into FDS.
However, there is nuance with caching. The built-in cache used in FDS is local and cannot be shared. If you would like to implement a shared cache, you can disable the built-in cache with the CacheSizeLimit config property and implement a shared request-response cache on your side.
To sum up, your autoscaling logic is sensible for improving performance during peak load. You would need to ensure that at least one instance with a loaded index is always up and running, and validate that the allocated RAM is sufficient for real data.
Please let us know if more questions arise.
Best regards,
Maksym
Hi,
It seems that application is being crashed with error out of memory even though consumption was only 75%. We are running application on container where we set rule to auto scale if threshold exceeds above 90%. Could you please let us know why it is not able to utilize available 25% ram ?
Thanks,
Varun
Hello, Varun,
Thank you for reaching out to us.
An out-of-memory crash can happen at the moment of a new allocation, even if reported usage is around 75%. If FDS requests a larger chunk of memory which exceeds the container limit, it can cause the out-of-memory error before all the memory is used. This could happen when FDS is trying to create a large index. We recommend increasing the total amount of RAM available per container.
Feel free to contact us if more questions arise.
Best regards,
Maksym
Hi,
We have a few additional questions:
Is there a mechanism for the process to wait for the next available ECS task when it encounters a memory constraint instead of failing immediately?
We receive a custom error message (as shown in the attached image), and in such cases the data also appears to be cleaned up. How can we capture the exact underlying error, and is there a way to prevent the data from being cleared when this error occurs?
It appears that memory is not being released when a column is first added (causing a memory spike) and later removed from the grid. What would be the recommended approach to ensure proper memory cleanup in this scenario?
We are using the Data Server DLL built on .NET Core.
Thanks
Varun
Hello, Varun,
Thank you for your questions.
Waiting for the next ECS container due to memory constraints
This question seems to be outside of Flexmonster's scope. We recommend checking AWS/ECS settings or consulting AWS support on this part.
Error message displayed & capturing pre-error state
Given that you reported OOM errors, the error in /select request you shared with us is likely caused by FDS running out of memory before that specific request is sent. However, to identify the exact cause of this issue, our team recommends enabling the Data Server logs and examining them after the error occurs. Please check this article to see how the logs can be enabled and configured with FDS DLL: https://www.flexmonster.com/doc/configure-logging-fds-dll/
Regarding your question about capturing the pre-error state of the grid, this is not supported in Flexmonster. Resolving the root cause of the issue is recommended rather than attempting to handle such errors on the client side.
Memory not being released
There are several main reasons that may cause the memory consumption to grow after the index was initially loaded:
We recommend experimenting with these settings to see how they affect memory usage and stability in your specific environment. The most conservative approach to minimize memory usage is to disable response caching and data refresh.
Please let us know if more questions arise.
Best regards,
Maksym
Hi,
We have CacheSizelimit to 0 and KeepDataOnRefresh =false. Moreover, memory is not being released even after deleting the index unless we restart the application .
Hello, Varun,
Thank you for the further explanation.
When an index is deleted, FDS does not explicitly trigger garbage collection. As a result, the memory previously used by that index may not be released immediately and can remain allocated until the .NET garbage collector reclaims it.
Additionally, upon another look at the previously reported error, we have a theory that it may also occur when attempting to access the index while it is reloading. However, as mentioned previously, reviewing the logs is the only reliable way to identify the exact cause: https://www.flexmonster.com/doc/configure-logging-fds-dll/
Feel free to contact us if more questions arise.
Best regards,
Maksym