<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    莊周夢(mèng)蝶

    生活、程序、未來(lái)
       :: 首頁(yè) ::  ::  :: 聚合  :: 管理
        上午測(cè)試了下并發(fā)情況下的表現(xiàn),測(cè)試場(chǎng)景:一個(gè)有20個(gè)節(jié)點(diǎn),包括選擇、順序、并行路由的流程,所有節(jié)點(diǎn)都設(shè)置為自動(dòng)執(zhí)行,1000個(gè)線程并發(fā)啟動(dòng)案例,也就是這個(gè)流程同時(shí)有1000個(gè)案例在跑,全部跑完結(jié)果差強(qiáng)人意,比單線程慢了接近30倍。仔細(xì)調(diào)整了算法和加鎖粒度,盡管整體性能有所提高,但是多線程和單線程間執(zhí)行的差距仍然沒(méi)有多大變化,性能瓶頸還是在核心的調(diào)度算法上,還需要分析下。測(cè)試程序如下:
    package net.rubyeye.insect.workflow.test;

    import java.util.ArrayList;
    import java.util.List;
    import java.util.concurrent.CyclicBarrier;

    import net.rubyeye.insect.workflow.Place;
    import net.rubyeye.insect.workflow.Token;
    import net.rubyeye.insect.workflow.Transition;
    import net.rubyeye.insect.workflow.WorkFlow;
    import net.rubyeye.insect.workflow.WorkFlowManager;
    import net.rubyeye.insect.workflow.basic.BasicWorkflowManager;
    import net.rubyeye.insect.workflow.comm.TransitionType;
    import net.rubyeye.insect.workflow.config.DefaultConfiguration;
    import junit.framework.TestCase;

    public class CompositeProcessTest extends TestCase {
        
    private WorkFlowManager wm;

        WorkFlow composite;

        
    private CyclicBarrier barrier;

        
    private static final int total = 1000;

        @Override
        
    protected void setUp() throws Exception {
            
    this.barrier = new CyclicBarrier(total + 1);
            wm 
    = new BasicWorkflowManager();
            wm.setConfiguration(
    new DefaultConfiguration());

            WorkFlow sequence 
    = wm.getWorkFlow("sequence");
            WorkFlow concurrency 
    = wm.getWorkFlow("concurrency");
            WorkFlow choose 
    = wm.getWorkFlow("choose");

            
    // 組合流程
            composite = new WorkFlow();
            composite.setName(
    "composite");
            composite.setId(
    100);

            wm.saveWorkFlow(composite);

            
    // 修改開(kāi)始結(jié)束節(jié)點(diǎn)的輸入輸出庫(kù)所
            sequence.getEnd().setType(TransitionType.NORMAL);
            sequence.getEnd().setOutputs(concurrency.getStart().getInputs());

            concurrency.getEnd().setType(TransitionType.NORMAL);
            concurrency.getEnd().setOutputs(choose.getStart().getInputs());

            composite.setStart(sequence.getStart());
            composite.setEnd(choose.getEnd());
            List
    <Transition> transitions = new ArrayList<Transition>();
            transitions.addAll(sequence.getTransitions());
            transitions.addAll(concurrency.getTransitions());
            transitions.addAll(choose.getTransitions());
            composite.setTransitions(transitions);
        }

        
    public void testConcurrencyCompositeProcesss() throws Exception {
            
    for (int i = 0; i < total; i++) {
                
    new FlowThread().start();
            }
            barrier.await();
            
    long start = System.currentTimeMillis();
            barrier.await();
            
    long end = System.currentTimeMillis();
            System.out.println(
    "創(chuàng)建" + total + "個(gè)流程并發(fā)運(yùn)行完畢\n花費(fèi)時(shí)間:" + (end - start)
                    
    / 1000.0 + "");
            
    for (Transition transition : composite.getTransitions()) {
                System.out.println(transition.getName() 
    + "  "
                        
    + transition.isEnable());
                
    for (Place place : transition.getOutputs()) {
                    System.out.println(
    "place " + place.getId() + " "
                            
    + place.getTokens().size());
                }
            }
        }

        
    public void testCompositeProcesss() throws Exception {
            
    long start = System.currentTimeMillis();
            
    for (int i = 0; i < total; i++) {
                Token token1 
    = wm.startWorkFlow("composite");
                token1.setAttribute(
    "name""dennis");
                token1.setAttribute(
    "num"21);
                wm.doAction(token1.getId());
                assertTrue(token1.isFinished());
            }
            
    long end = System.currentTimeMillis();
            System.out.println(
    "創(chuàng)建" + total + "個(gè)流程運(yùn)行完畢\n花費(fèi)時(shí)間:" + (end - start)
                    
    / 1000.0 + "");
        }

        
    class FlowThread extends Thread {

            @Override
            
    public void run() {
                
    try {
                    barrier.await();
                    
    // wm = new BasicWorkflowManager();
                    Token token1 = wm.startWorkFlow("composite");
                    token1.setAttribute(
    "name""dennis");
                    token1.setAttribute(
    "num"21);
                    wm.doAction(token1.getId());
                    assertTrue(token1.isFinished());
                    barrier.await();
                } 
    catch (Exception e) {
                    
    throw new RuntimeException(e);
                }
            }

        }
    }


    評(píng)論

    # fatdiminishersystem91202  回復(fù)  更多評(píng)論   

    2015-10-30 21:08 by I know this if off topic but I'm looking into star
    I know this if off topic but I'm looking into starting my own weblog and was curious what all is needed to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100% certain. Any suggestions or advice would be greatly appreciated. Many thanks

    # numériservoscassettes39866  回復(fù)  更多評(píng)論   

    2015-11-01 10:21 by I want to to thank you for this very good read!! I
    I want to to thank you for this very good read!! I absolutely loved every bit of it. I have you book-marked to check out new things you post…

    # loansforpeoplewithbadcredit71577  回復(fù)  更多評(píng)論   

    2015-11-02 03:02 by If some one desires to be updated with latest tech
    If some one desires to be updated with latest technologies afterward he must be visit this website and be up to date all the time.

    # skisafari2triche85524  回復(fù)  更多評(píng)論   

    2015-11-04 08:15 by You ought to take part in a contest for one of the
    You ought to take part in a contest for one of the finest websites on the web. I'm going to recommend this website!

    # clashofclanshack804  回復(fù)  更多評(píng)論   

    2015-11-19 10:34 by You need to learn about the content and safety set
    You need to learn about the content and safety settings of your game systems. The picture to the right is of one of the many rites you can earn in the game. Try to keep your stash of wood as low as possible to minimize the wood losses during attacks.

    # clashofclanshack20181  回復(fù)  更多評(píng)論   

    2015-11-19 21:18 by If you wish to give a game a try, the library may
    If you wish to give a game a try, the library may have a copy. Make sure to take breaks between quests, races and fights. Give a warning, first and maybe even start a new activity.

    # japanesegirlsmovie19025  回復(fù)  更多評(píng)論   

    2016-04-06 20:23 by Its like you read my mind! You seem to know a lot
    Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but other than that, this is great blog. A fantastic read. I will definitely be back.

    # clashofclanshack1155  回復(fù)  更多評(píng)論   

    2016-06-14 22:17 by Very clean site, thanks for this post.
    Very clean site, thanks for this post.
    Good post. I learn something totally new and challenging on sites I stumbleupon on a daily basis. It will always be helpful to read content from other writers and practice something from their web sites.

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲AV无码一区二区三区国产 | 美女被免费视频网站| 午夜亚洲www湿好大| 亚洲精品无码你懂的网站| 免费观看黄网站在线播放| 免费黄网站在线看| 一级毛片免费播放试看60分钟| 亚洲色偷偷偷综合网| 亚洲黄色在线电影| 久久精品国产亚洲AV果冻传媒| 久久亚洲AV无码西西人体| 免费看国产一级特黄aa大片| 免费观看黄网站在线播放| 我的小后妈韩剧在线看免费高清版| 精品视频在线免费观看| 久久免费视频一区| 国产日韩AV免费无码一区二区三区| 国产亚洲精品仙踪林在线播放| 亚洲爆乳精品无码一区二区| 亚洲人成77777在线观看网| 亚洲一级毛片中文字幕| 亚洲伊人久久大香线蕉在观| 亚洲精品电影天堂网| 亚洲视频在线观看免费视频| 亚洲一区二区成人| 久久精品国产亚洲AV香蕉| 久久久久亚洲AV无码麻豆| 亚洲精品国产第1页| 亚洲成人午夜电影| 亚洲制服丝袜在线播放| 久久精品国产亚洲av麻豆蜜芽| 亚洲三级在线播放| 亚洲欧美综合精品成人导航| 亚洲AV综合永久无码精品天堂| 亚洲欧美成aⅴ人在线观看| 亚洲AV一区二区三区四区| 久久亚洲中文无码咪咪爱| 色屁屁在线观看视频免费| gogo免费在线观看| 久久香蕉国产线看免费| 精品成在人线AV无码免费看 |