duansha3771 2012-09-26 13:59
浏览 111
已采纳

PHP多次运行.jar文件 - 可伸缩性?

I am building a web application for chemical industry. Its basically searching in database of chemical structures. A lot of cheminformatics calculations is needed and there are many open source solutions to do it written in Java.

I am currently wondering what programming language to use. I need to use some functions in Java and I dont want to write whole system in Java because I am not familiar with writing web apps in it.

So I have this idea to prepare some .jar files with needed functions and use them in PHP through command line. I wonder about scalability of this solution.

Is it fast to call .jar file in PHP for example 1000 times in one cycle? How long the parameter passed to .jar can be? I assume large arrays converted to string as parameters. I have doubts if this is a good idea in general and why I sould not do this?

Thank you for your ideas.

  • 写回答

3条回答 默认 最新

  • dpfqy5976 2012-09-26 14:28
    关注

    It can be done

    You mention parameters. I assume you mean command line parameter. You are correct that is probably not scaleable. Instead, use stdin for input and stdout for output.

    You mention calling the jar file 1000 times. I assume you mean calling the main method of the jar file. This will be very slow. Instead implement as much as you can in java, so you start the jar file few times per request. A handfull calls could be acceptable. Just not anything in a loop.

    Basicly prepare all the data for an entire requuest inside java and print it to stdout which you read from php.

    Of course running in a servlet container is faster if you have time to learn jsp+servlet.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比