简体   繁体   English

用Java和PHP应用程序进行memcached

[英]memcached with a java and php application

I have an application that involves logging the status of up to 8000 devices every 1-2mins via a java application, and storing the deviceid, time, and status in a table in the database. 我有一个应用程序,它涉及通过Java应用程序每1-2分钟最多记录8000个设备的状态,并将设备ID,时间和状态存储在数据库的表中。

The next component of this application, is a PHP interface which displays the most recent status of these devices (ones that are assigned to the user logging in, there may be at max 500 concurrent users ie viewing 16 devices each, but more than likely an average load of 50-100 users). 该应用程序的下一个组件是一个PHP界面,该界面显示这些设备的最新状态(分配给登录用户的状态,最多可以有500个并发用户,即每个用户同时查看16个设备,但平均负载为50-100个用户)。 The application will also print reports on the status over time of the device. 该应用程序还将打印有关设备状态的报告。

I was considering using memcached in the java application to store the most recent status for each deviceid, and then having the php application just access the memcached to populate the display. 我正在考虑在Java应用程序中使用memcached来存储每个deviceid的最新状态,然后让php应用程序仅访问memcached来填充显示。 The reports on previous status would still come off the database as they are run infrequently. 由于先前状态的报告很少运行,因此仍会从数据库中删除。

My confusion has come about in deciding whether it would be performance worthy to write memcached in to this application, as the performance of memcached is apparently realised with mutliple hits per cache update. 我的困惑在于决定是否应该将memcached写入此应用程序,因为memcached的性能显然是通过每次缓存更新时的多个命中实现的。 This application would likely have multiple updates (however pushed directly from the app, not the db), per cache read. 每次读取缓存时,此应用程序可能会有多个更新(但是直接从应用程序而不是数据库推送)。 But would save reads on a reasonably sized (2-3gb) status table. 但这会将读取保存在大小合理的(2-3gb)状态表中。

Also, is there any interoperabilty issues writing/reading to memcached from different languages API's? 另外,是否存在从不同语言API写入/读取内存缓存的互操作性问题?

You probably already have an effient multi-language chaching mechanism built into your RDBMS! 您可能已经在RDBMS中内置了有效的多语言跟踪机制! Its unlikely that can improve by much the caching and concurency mechanisms built into your database system. 它不太可能通过数据库系统中内置的大量缓存和并发机制来改善。 Your time would be better spent tuning your SQL to ensure it takes maximum advantage if these mechinisms. 如果对这些机制进行调整,最好花时间调整SQL以确保最大程度地利用SQL。 (Ensuring concurrency settings in SELECT allow "dirty reads", keeping units of work (the processing between BEGIN TRANSACTION and COMMIT) as short as possible etc. etc.). (确保SELECT中的并发设置允许“脏读”,使工作单元(BEGIN TRANSACTION和COMMIT之间的处理尽可能短)等)。

As per comment on INNODB the following command:- 根据对INNODB的注释,以下命令:

set transaction isolation level read uncommitted;

will allow you to read any inserted rows beofre they are committed and will totally igonore any locking and concurrency. 将允许您在提交之前读取所有插入的行,并且完全不涉及任何锁定和并发。 This would boost you performance without causing you any problems as the Java half of the application is inserting only. 这将提高性能,而不会引起任何问题,因为该应用程序的Java一半仅在插入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM