Isapi 过滤器 - 状态
我有一个 isapi 文件管理器,我想添加一个基于传入域的逻辑(我的服务器场托管许多域)。 域列表是动态的,我可以将这些域列表导出到文本文件中并从 isapi 读取它,但是有没有办法将此文件保留在内存中(数组或链表)以保存 IO 调用。 类似于全局应用程序状态。
I have a isapi filer and I want to add a logic based on the incoming domain ( my server farm hosts many domains).
There domain list is dynamic , I can export these domain list into a text file and read it from the isapi , but is there a way to keep this file in memory (is array or linked list) to save the IO call.
similar to global application state .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的工作进程如何分布在服务器上?您是拥有一台带有一个工作进程的服务器,还是拥有多台服务器?
如果您在一台服务器上有多个工作进程,您可以使用命名共享内存。我之前曾在 ISAPI 过滤器中使用过它来共享信息,并且效果非常好。它甚至应该为您处理并发性。您可以在此处阅读更多信息: http:// msdn.microsoft.com/en-us/library/aa366551%28v=vs.85%29.aspx
如果您分布在多个服务器上,则可以使用分布式缓存,例如 memcached。这设置起来比较复杂,但会给您带来良好的性能。这里有一个关于设置此内容的线程:C++ api for memcache
How are your worker processes distributed across your servers? Do you have one server with one worker process, or multiple servers?
If you have one server with one worker process, you can just read the file into a static array or string to manage it (just make sure you account for concurrent threads reading/modifying it simultaneously)
If you have multiple worker processes on just one server, you can use named shared memory. I've used this before in ISAPI filters to share information, and it works pretty well. It should even take care of concurrency for you. You can read more here: http://msdn.microsoft.com/en-us/library/aa366551%28v=vs.85%29.aspx
If you're spread across multiple servers, you could use a distributed cache like memcached. This is more complex to set up, but it'll give you good performance. There's a thread on setting this up here: C++ api for memcache