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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题