Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

labelpsi 序列化处理解决cache内存大问题 #86

Open
yellow123Nike opened this issue Mar 29, 2023 · 14 comments
Open

labelpsi 序列化处理解决cache内存大问题 #86

yellow123Nike opened this issue Mar 29, 2023 · 14 comments
Assignees

Comments

@yellow123Nike
Copy link

您好请问labelpsi这里通过serializable进行序列化存储BinBundle,以降低整个bundle-cache占用内存大问题。然后在查询阶段是否还是要将整个serializable在反序列化为senderdb。另外,请问这三个变量(
std::shared_ptryacl::io::KVStore meta_info_store_;
std::vector<std::shared_ptryacl::io::IndexStore> bundles_store_;
std::vector<size_t> bundles_store_idx_;)
分别是存储什么信息?代码看的有点蒙[捂脸哭]
``
image

@yellow123Nike
Copy link
Author

常俊老师回答:meta_info_store存储一些配置信息,bundle_store存储序列化的bundle,用的时候读入,用完就可以释放了。

@yellow123Nike
Copy link
Author

再次询问:bundle_store就类似APSI源码里的flatbuffers吗?源码是通过flatbuffers存储为二进制文件。意思是查询时整个bundle_store都要重写加载进来,还是会通过index加载对应的bundle?

@yellow123Nike
Copy link
Author

常俊老师回答:flatbuffer用作序列化,bundle_store替代apsi的vector存储

@yellow123Nike
Copy link
Author

请问:/spu/examples/cpp/pir/keyword_pir_server.cc 这里,没有看到数据方的数据预处理过程。
image
1.这里是直接读取的预处理好的kvstore吗?
先执行一下keyword_pir_setup.cpp得到kvstore再执行keyword_pir_server.cc 吗?

@zhanglei486
Copy link

请问:/spu/examples/cpp/pir/keyword_pir_server.cc 这里,没有看到数据方的数据预处理过程。 image 1.这里是直接读取的预处理好的kvstore吗? 先执行一下keyword_pir_setup.cpp得到kvstore再执行keyword_pir_server.cc 吗?

是的

@yellow123Nike
Copy link
Author

您好,这个图片中的while循环,针对大文件进行批次读取似乎对内存的影响不是很大
image
对bundle的序列化存储时,貌似内存占用大小是一样的,因为bundle_index等于1。百万数据集,nr=256,ns=1000000,内存占用16.17GB
image
image

@zhanglei486
Copy link

您好,这个图片中的while循环,针对大文件进行批次读取似乎对内存的影响不是很大 image 对bundle的序列化存储时,貌似内存占用大小是一样的,因为bundle_index等于1。百万数据集,nr=256,ns=1000000,内存占用16.17GB image image
针对一个bundle的序列化内存消耗是一样的,多个bundle时转到外部存储,可以降低内存消耗

@yellow123Nike
Copy link
Author

请问bundle_indices怎么设置呀?不管多大的数据,都是1.
image

@zhanglei486
Copy link

zhanglei486 commented Mar 31, 2023

image

https://github.com/microsoft/APSI/blob/main/common/apsi/psi_params.cpp 具体参数可以参考APSI的psi_params

https://github.com/microsoft/APSI/blob/main/sender/apsi/sender_db.cpp#L79

@yellow123Nike
Copy link
Author

如果是这样的话,8c16g 批量查询256 数据方集合100w是跑不下来的?

@zhanglei486
Copy link

zhanglei486 commented Apr 3, 2023

如果是这样的话,8c16g 批量查询256 数据方集合100w是跑不下来的?

具体信息可以跑一下测试,我这边观察到的内存占用是2G(label大小为32B)左右

@yellow123Nike
Copy link
Author

image

参数设置如下,100万数据,label大小为288byte(不知道我理解的对不对,因为生成了两个label,一个label144,所以实际插值是288bit) 最终binbundle执行cache计算的内存消耗并没有进行优化。仍然需要消耗11g

image

@zhanglei486
Copy link

binbundle的cache实现还是依赖微软的,label越大内存占用也会越大,可以结合实际项目确定label大小,选择相应的机器配置

@yellow123Nike
Copy link
Author

收到,非常感谢。我再看看这方面能不能优化(难受,哈哈)

@anakinxc anakinxc transferred this issue from secretflow/spu Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants