Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Alfresco勉強会#40 Alfrescoに大量のコンテンツを”なるべく簡単に”投入する方法

Alfresco勉強会#40 Alfrescoに大量のコンテンツを”なるべく簡単に”投入する方法

第40回Alfresco勉強会で発表した内容です。性能テスト等のためにAlfrescoに大量にデータを投入したい、ただしなるべく簡単に、という場合に使える方法をご紹介しました。

88fe1a9048ec5e374b2c37e76fbdbe7a?s=128

Jun TERASHITA

August 23, 2017
Tweet

Transcript

  1.  ˜ ೥݄೔ +VO5FSBTIJUB ୈճ"MGSFTDPษڧձ "MGSFTDPʹେྔͷίϯςϯπΛ zͳΔ΂͘؆୯ʹz౤ೖ͢Δํ๏

  2.  ˜  ൃද಺༰ ੑೳςετ΍ΧελϚΠζͨ͠ػೳͷಈ࡞֬ೝͷͨΊʹ"MGSFTDPʹେ ྔͷςετσʔλΛzͳΔ΂͘؆୯ʹz౤ೖ͍ͨ͠ɺͱ͍͏࣌ʹ࢖͑Δ ํ๏Λ͝঺հ͠·͢ɻ ˞ϢʔβΛେྔʹొ࿥͍ͨ͠৔߹͸&YDFMϑΝΠϧͷΠϯϙʔτ͕ศརʢ࢖͍ํ͸ͪ͜Βʣ

  3.  ˜  #VML*NQPSU5PPMΛ࢖͏΄ͲͰ͸ͳ͍ɺͱ͍͏࣌ w αʔόͷϩʔΧϧʹϑΥϧμߏ଄Λ४උͯ͠ɺଐੑ৘ใΛ༩͑ΔͨΊʹ͸ݸผʹYNMΛ࡞Δඞ ཁ͕͋Δʢ࢖͍ํͷৄࡉʹ͍ͭͯ͸ͪ͜Βʣɻ w σʔλҠߦ౳ɺຊؾͰ΍Δ৔߹ʹ͸༗༻͕ͩ؆୯ʹ΍Γ͍ͨͱ͍͏༻్ʹ͸޲͔ͳ͍ɻ

  4.  ˜  +BWB4DSJQUͰ΍Γ͍ͨɺ͕ɾɾɾ w جຊతͳϑΝΠϧʗϑΥϧμʹର͢Δૢ࡞͸ͳΜͰ΋Ͱ͖Δ͠ɺ+BWBTDSJQU$POTPMFͱ͍͏ඇ ৗʹศརͳπʔϧ͕͋ΔͷͰɺ͍Ζ͍Ζࢼ͍ͨ࣌͠ʹศརʢ+BWBTDSJQU$POTPMFʹ͍ͭͯͷ ৄ͍͠આ໌͸ͪ͜Βʣ w ͨͩ͠ɺ+BWB4DSJQUͰ͸͢΂ͯͷॲཧ͕τϥϯβΫγϣϯͰ࣮ߦ͞Εͯ͠·͏ͨΊɺ్தͰ

    ࢭ·ͬͨ࣌͸શ෦ϩʔϧόοΫ͞Εͯ͠·͏ɻͦͷ··Ͱ͸େྔσʔλͷ౤ೖʹ͸࢖͍ͮΒ ͍ɻ
  5.  ˜  "MGSFTDP+BWB4DSJQU#BUDI&YFDVUFS w (JU)VCͰެ։͞Ε͍ͯΔ+BWB4DSJQUͰόονॲཧΛ࣮ߦ͢ΔͨΊͷπʔϧ
 IUUQTHJUIVCDPNDJCFSBMGSFTDPKTCBUDIFYFDVUFS w 3&"%.&NE͔Βͷൈਮ …

    Then you know that repo-side scripts run slow and in one transaction: you may wait a day for it to finish, and if it fails then nothing is saved. It makes it almost impossible to use repo-side JavaScript for bulk processing. Alfresco JavaScript Batch Executer tool is aimed to solve this problem in multithreaded and transactional manner. It can do the job 10 times faster, while clearly showing the progress and also allowing you to cancel running jobs. …
  6.  ˜  #BUDI&YFDVUFSͷΠϯετʔϧํ๏ͱ࢖͍ํ w Πϯετʔϧ͸+"3ϑΝΠϧΛҎԼͷσΟϨΫτϦʹஔ͚ͩ͘ɻ
 BMG@EJSUPNDBUXFCBQQTBMGSFTDP8&#*/'MJC w Πϯετʔϧ͢Δͱɺ+BWB4DSJQUͰʮCBUDI&YFDVUFSʯͱ͍͏ϧʔτΦϒδΣΫτ͕࢖͑ΔΑ ͏ʹͳΔɻ

    w CBUDI&YFDVUFSͷϝιου͸ҎԼͷͭɻ w QSPDFTT'PMEFS3FDVSTJWFMZ
 SPPUͱ͍͏ύϥϝʔλͰ༩͑ΒΕͨϊʔυ഑Լͷϊʔυʹରͯ͠࠶ؼతʹ0O/PEF΍ 0O#BUDIͷॲཧΛ࣮ߦ͢Δ w QSPDFTT"SSBZ
 JUFNTͱ͍͏ύϥϝʔλͰ༩͑ΒΕͨ഑ྻͷݸʑͷཁૉʹରͯ͠ɺ0O/PEF΍0O#BUDIͷ ॲཧΛ࣮ߦ͢Δ
  7.  ˜  #BUDI&YFDVUFSͷϝιουʹ༩͑Δύϥϝʔλ ύϥϝʔλ໊ આ໌ SPPU QSPDFTT'PMEFS3FDVSTJWFMZΛ࢖͏࣌͸ඞਢɻϧʔτϑΥϧμͷ 4DSJQU/PEFͰࢦఆ͢Δɻ JUFNT

    QSPDFTT"SSBZΛ࢖͏࣌͸ඞਢɻ0O/PEF΍0O#BUDIͷॲཧର৅ͱͳ Δཁૉͷ഑ྻɻݸʑͷཁૉ͸4DSJQU/PEFͰ͋Δඞཁ͸ͳ͘ɺจࣈྻ ΍ଞͷ+BWB4DSJQUΦϒδΣΫτͰ΋Α͍ɻ CBUDI4J[F ͜ͷCBUDI4J[FΛτϥϯβΫγϣϯʹ·ͱΊͯίϛοτ͢Δɻσϑ Υϧτ஋͸ɻ UISFBET εϨουͷ਺ɻσϑΥϧτ஋͸ɻ EJTBCMF3VMFT ϑΥϧμͷϧʔϧΛແޮԽ͢Δ͔Ͳ͏͔ɻσϑΥϧτ஋͸GBMTFɻ PO/PEF SPPU഑Լͷϊʔυ΍JUFNTͰ౉͞Εͨ഑ྻͷཁૉΛͭͣͭॲཧ͢Δ ͨΊͷؔ਺ɻ PO#BUDI SPPU഑Լͷϊʔυ΍JUFNTͰ౉͞Εͨ഑ྻͷཁૉΛCBUDI4J[F෼·ͱ Ίͯॲཧ͢ΔͨΊͷؔ਺ɻͭͷόονͷதͰॲཧΛάϧʔϐϯά͠ ͍ͨ࣌΍ΑΓޮ཰Խ͍ͨ࣌͠ʹ࢖͏ʢΒ͍͠ʣɻ
  8.  ˜  ࢖༻ྫ w ΧϯύχʔϗʔϜͷ௚Լͷʮ5FTU%BUBʯϑΥϧμʹϑΥϧμΛݸɺͦͷ֤ϑΥϧμ಺ʹ ςΩετϑΝΠϧΛݸ࡞੒͢Δʢ͜ͷఔ౓ͷ਺Ͱ͋Ε͹#BUDI&YFDVUPSͳ͠Ͱ΋͙͢ʹ ऴΘΔͷͰɺ͋͘·Ͱ΋σϞ༻ͷεΫϦϓτͰ͢ʣɻ var targetFolder

    = companyhome.childByNamePath("Test Data"); batchExecuter.processArray({ items: companyhome.childByNamePath("batchExecuter_testdata.csv").content.split("\n"), batchSize: 5, threads: 2, onNode: function(item) { logger.log(item); var folder = targetFolder.createFolder(item); for (var i=0; i<10; i++) { var filename = "file" + ("0" + i).slice(-2) + ".txt"; var file = folder.createFile(filename); file.content = file.name + " created in " + folder.name + " folder"; } } }); ˞JUFNTͷ഑ྻ͸εΫϦϓτ಺Ͱੜ੒ͯ͠΋Α͍͠ɺ্هͷΑ͏ʹ$47ϑΝΠϧ͔ΒಡΈࠐΜͰ ΋Α͍ɻ͜͜Ͱ͸ΧϯύχʔϗʔϜͷ௚ԼʹʮCBUDI&YFDVUFS@UFTUEBUBDTWʯͱ͍͏໊લͰϑΥ ϧμ໊Λݸॎʹฒ΂ͨ$47ϑΝΠϧΛΞοϓϩʔυͯ͋͠Δɻ
  9.  ˜  ͓·͚ w "MGSFTDPʹ֨ೲ͞Ε͍ͯΔίϯςϯπͷ਺Λௐ΂͍ͨ࣌͸ͪ͜Βͷ#MPHͰ঺հ͞Ε͍ͯΔํ ๏Λ࢖͏ͷ͕ศརɻ
 IUUQTBOHFMCPSSPZXPSEQSFTTDPNFYUSBUJOHTJNQMFTUBUTGSPNBMGSFTDP w ҎԼͷ3&45"1*Λୟ͘ͱ֨ೲ͞Ε͍ͯΔίϯςϯπͷ؆୯ͳ౷ܭ৘ใ͕ಘΒΕΔɻ


    IUUQBMG@IPTUQPSUBMGSFTDPTBQJTPMSTUBUT w ϑΝηοτݕࡧͰ݁ՌΛϑΟϧλϦϯά͢Δ࣌ʹ࢖͑ΔϑΟʔϧυ͸ҎԼͰ֬ೝɻ
 IUUQBMG@IPTUQPSUBMGSFTDPTBQJTPMSTUBUT MJTU'BDFUTUSVF w ྫɿίϯςϯπͷ࡞੒ऀΛࢦఆ͢Δ৔߹
 IUUQBMG@IPTUQPSUBMGSFTDPTBQJTPMSTUBUT GBDFUDPOUFOUDSFBUPS
  10. ʢσϞʣ

  11.  ˜  ·ͱΊ w"MGSFTDPʹςετσʔλΛେྔʹ౤ೖ͢Δ࣌ʹ࢖͑ΔπʔϧΛ͝঺հ͠·ͨ͠ɻ w+BWBTDSJQU$POTPMFͱ#BUDI&YFDVUPSΛ߹Θͤͯ࢖͏ͷ͕ΦεεϝͰ͢ɻ

  12. None