dsfdsf48652 2013-11-23 04:52
浏览 22

经常使用PHP解析和存储文本

I am creating a php script that parses a string of text typically 500-750 characters using regex expressions to find 5-6 substrings. The extracted info is manipulated a bit and then stored in a database. Once implemented, the script will be executed every few seconds on average throughout the day. Will an average webserver be able to handle this level of usage? I'm not sure how memory intensive this type of script would be with the frequency its executed.

I was thinking through possible ways of reducing the load on the server and came up with an idea which i'm not sure is any better. Instead of parsing the raw text instantly when received, I could store it in a database to be parsed later. Throughout the day I could then have the server process the info in manageable quantities and during periods of low site traffic. If this is a solution, would the below algorithm be an okay way to approach it?

  1. Select a few text records which have yet to be parsed from a database
  2. Extract info from the text and add them to the database
  3. Update the text records to indicate they've been parsed
  4. Have the script reload using <meta http-equiv="refresh">
  5. Repeat x amount of times

Any advice on how to approach this would be appreciated, thanks!

  • 写回答

1条回答 默认 最新

  • doukenqiong0588 2013-11-23 07:25
    关注

    From you description it doesn't seem like something very demanding on the server.

    I'd recommend to implement the simplest solution for parsing and storing data. Then feed this piece of code with load of data and measure throughput. This can give you some clue how fast can you process the records.

    After this you can estimate if this simple approach is sufficient or not.

    评论

报告相同问题?

悬赏问题

  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)