run_ffead.sh 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. #!/bin/sh
  2. rm -f /usr/local/lib/libffead-*
  3. rm -f /usr/local/lib/libte_benc*
  4. rm -f /usr/local/lib/libinter.so
  5. rm -f /usr/local/lib/libdinter.so
  6. export FFEAD_CPP_PATH=${IROOT}/$1
  7. ln -s ${FFEAD_CPP_PATH}/lib/libte-benchmark-um.so /usr/local/lib/libte-benchmark-um.so
  8. ln -s ${FFEAD_CPP_PATH}/lib/libte-benchmark-um-pq.so /usr/local/lib/libte-benchmark-um-pq.so
  9. ln -s ${FFEAD_CPP_PATH}/lib/libte-benchmark-um-mgr.so /usr/local/lib/libte-benchmark-um-mgr.so
  10. ln -s ${FFEAD_CPP_PATH}/lib/libte-benchmark-um-pq-async.so /usr/local/lib/libte-benchmark-um-pq-async.so
  11. ln -s ${FFEAD_CPP_PATH}/lib/libffead-modules.so /usr/local/lib/libffead-modules.so
  12. ln -s ${FFEAD_CPP_PATH}/lib/libffead-framework.so /usr/local/lib/libffead-framework.so
  13. ln -s ${FFEAD_CPP_PATH}/lib/libinter.so /usr/local/lib/libinter.so
  14. ln -s ${FFEAD_CPP_PATH}/lib/libdinter.so /usr/local/lib/libdinter.so
  15. ldconfig
  16. if [ "$2" = "nginx" ]
  17. then
  18. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  19. then
  20. export PATH=${IROOT}/nginx-ffead-sql/sbin:${PATH}
  21. else
  22. export PATH=${IROOT}/nginx-ffead-mongo/sbin:${PATH}
  23. fi
  24. fi
  25. export LD_LIBRARY_PATH=${IROOT}/:${IROOT}/lib:${FFEAD_CPP_PATH}/lib:/usr/local/lib:$LD_LIBRARY_PATH
  26. export ODBCINI=${IROOT}/odbc.ini
  27. export ODBCSYSINI=${IROOT}
  28. export LD_PRELOAD=/usr/local/lib/libmimalloc.so
  29. #export LD_PRELOAD=$IROOT/snmalloc-0.5.3/build/libsnmallocshim.so
  30. cd $FFEAD_CPP_PATH
  31. #use below settings only for debugging
  32. #echo '/tmp/core.%h.%e.%t' > /proc/sys/kernel/core_pattern
  33. #ulimit -c unlimited
  34. service redis-server stop
  35. service apache2 stop
  36. service memcached stop
  37. if [ "$3" = "mongo" ]
  38. then
  39. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um
  40. rm -rf web/te-benchmark-um-mgr web/te-benchmark-um-pq web/te-benchmark-um-pq-async
  41. cp -f ${WEB_DIR}/config/sdormmongo.xml ${WEB_DIR}/config/sdorm.xml
  42. elif [ "$3" = "mongo-raw" ]
  43. then
  44. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um-mgr
  45. rm -rf web/te-benchmark-um web/te-benchmark-um-pq web/te-benchmark-um-pq-async
  46. elif [ "$3" = "mysql" ]
  47. then
  48. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um
  49. rm -rf web/te-benchmark-um-mgr web/te-benchmark-um-pq web/te-benchmark-um-pq-async
  50. cp -f ${WEB_DIR}/config/sdormmysql.xml ${WEB_DIR}/config/sdorm.xml
  51. elif [ "$3" = "postgresql" ]
  52. then
  53. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um
  54. rm -rf web/te-benchmark-um-mgr web/te-benchmark-um-pq web/te-benchmark-um-pq-async
  55. cp -f web/te-benchmark-um/config/sdormpostgresql.xml web/te-benchmark-um/config/sdorm.xml
  56. elif [ "$3" = "postgresql-raw" ]
  57. then
  58. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um-pq
  59. rm -rf web/te-benchmark-um web/te-benchmark-um-mgr web/te-benchmark-um-pq-async
  60. sed -i 's|<async>true</async>|<async>false</async>|g' ${WEB_DIR}/config/sdorm.xml
  61. elif [ "$3" = "postgresql-raw-async" ]
  62. then
  63. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um-pq-async
  64. rm -rf web/te-benchmark-um web/te-benchmark-um-mgr web/te-benchmark-um-pq
  65. sed -i 's|<async>false</async>|<async>true</async>|g' ${WEB_DIR}/config/sdorm.xml
  66. else
  67. WEB_DIR=$FFEAD_CPP_PATH/web/te-benchmark-um
  68. rm -rf web/te-benchmark-um-mgr web/te-benchmark-um-pq web/te-benchmark-um-pq-async
  69. fi
  70. if [ "$4" = "memory" ]
  71. then
  72. cp -f ${WEB_DIR}/config/cachememory.xml ${WEB_DIR}/config/cache.xml
  73. elif [ "$4" = "redis" ]
  74. then
  75. service redis-server start
  76. cp -f ${WEB_DIR}/config/cacheredis.xml ${WEB_DIR}/config/cache.xml
  77. elif [ "$4" = "memcached" ]
  78. then
  79. service memcached start
  80. cp -f ${WEB_DIR}/config/cachememcached.xml ${WEB_DIR}/config/cache.xml
  81. fi
  82. rm -f rtdcf/*.d rtdcf/*.o
  83. rm -f *.cntrl
  84. rm -f tmp/*.sess
  85. if [ ! -d tmp ]; then
  86. mkdir tmp
  87. fi
  88. chmod 700 ffead-cpp*
  89. chmod 700 resources/*.sh
  90. chmod 700 tests/*
  91. chmod 700 rtdcf/*
  92. if [ "$2" = "emb" ]
  93. then
  94. sed -i 's|EVH_SINGLE=false|EVH_SINGLE=true|g' resources/server.prop
  95. for i in $(seq 0 $(($(nproc --all)-1))); do
  96. taskset -c $i ./ffead-cpp $FFEAD_CPP_PATH &
  97. done
  98. elif [ "$2" = "lithium" ]
  99. then
  100. ./ffead-cpp-lithium $FFEAD_CPP_PATH &
  101. elif [ "$2" = "cinatra" ]
  102. then
  103. ./ffead-cpp-cinatra $FFEAD_CPP_PATH &
  104. elif [ "$2" = "drogon" ]
  105. then
  106. ./ffead-cpp-drogon $FFEAD_CPP_PATH &
  107. elif [ "$2" = "apache" ]
  108. then
  109. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  110. then
  111. sed -i 's|/installs/ffead-cpp-6.0|'/installs/ffead-cpp-6.0-sql'|g' /etc/apache2/apache2.conf
  112. sed -i 's|/installs/ffead-cpp-6.0|'/installs/ffead-cpp-6.0-sql'|g' /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/ffead-site.conf
  113. fi
  114. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' web/te-benchmark-um/config/sdorm.xml
  115. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' web/te-benchmark-um/config/cache.xml
  116. apachectl -D FOREGROUND
  117. elif [ "$2" = "nginx" ]
  118. then
  119. mkdir -p ${IROOT}/nginxfc/logs
  120. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' web/te-benchmark-um/config/sdorm.xml
  121. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' web/te-benchmark-um/config/cache.xml
  122. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  123. then
  124. nginx -g 'daemon off;' -c ${IROOT}/nginx-ffead-sql/conf/nginx.conf
  125. else
  126. nginx -g 'daemon off;' -c ${IROOT}/nginx-ffead-mongo/conf/nginx.conf
  127. fi
  128. elif [ "$2" = "libreactor" ]
  129. then
  130. cd ${IROOT}
  131. ./libreactor-ffead-cpp $FFEAD_CPP_PATH 8080
  132. elif [ "$2" = "h2o" ]
  133. then
  134. cd ${IROOT}/lang-server-backends/c/h2o
  135. ./h2o.sh ${FFEAD_CPP_PATH} ${LD_LIBRARY_PATH} 8080
  136. elif [ "$2" = "crystal-http" ]
  137. then
  138. cd ${IROOT}
  139. for i in $(seq 0 $(($(nproc --all)-1))); do
  140. taskset -c $i ./crystal-ffead-cpp.out --ffead-cpp-dir=$FFEAD_CPP_PATH --to=8080 &
  141. done
  142. elif [ "$2" = "crystal-h2o" ]
  143. then
  144. cd ${IROOT}
  145. for i in $(seq 0 $(($(nproc --all)-1))); do
  146. taskset -c $i ./h2o-evloop-ffead-cpp.out --ffead-cpp-dir=$FFEAD_CPP_PATH --to=8080 &
  147. done
  148. elif [ "$2" = "julia-http" ]
  149. then
  150. for i in $(seq 0 $(($(nproc --all)-1))); do
  151. julia ${IROOT}/lang-server-backends/julia/http.jl/server.jl $FFEAD_CPP_PATH
  152. done
  153. elif [ "$2" = "swift-nio" ]
  154. then
  155. cd ${IROOT}
  156. ./app $FFEAD_CPP_PATH
  157. elif [ "$2" = "d-hunt" ]
  158. then
  159. cd ${IROOT}
  160. ./hunt-minihttp -s $FFEAD_CPP_PATH
  161. elif [ "$2" = "rust-actix" ]
  162. then
  163. cd ${IROOT}
  164. ./actix-ffead-cpp $FFEAD_CPP_PATH 8080
  165. elif [ "$2" = "rust-hyper" ]
  166. then
  167. cd ${IROOT}
  168. ./hyper-ffead-cpp $FFEAD_CPP_PATH 8080
  169. elif [ "$2" = "rust-thruster" ]
  170. then
  171. cd ${IROOT}
  172. ./thruster-ffead-cpp $FFEAD_CPP_PATH 8080
  173. elif [ "$2" = "rust-rocket" ]
  174. then
  175. cd ${IROOT}
  176. ./rocket-ffead-cpp $FFEAD_CPP_PATH 8080
  177. elif [ "$2" = "go-fasthttp" ]
  178. then
  179. cd ${IROOT}
  180. ./fasthttp-ffead-cpp --server_directory=$FFEAD_CPP_PATH -addr=8080
  181. elif [ "$2" = "go-gnet" ]
  182. then
  183. cd ${IROOT}
  184. ./gnet-ffead-cpp --server_directory=$FFEAD_CPP_PATH --port=8080
  185. elif [ "$2" = "v-vweb" ]
  186. then
  187. cd ${IROOT}
  188. for i in $(seq 0 $(($(nproc --all)-1))); do
  189. taskset -c $i ./vweb --server_dir=$FFEAD_CPP_PATH --server_port=8080 &
  190. done
  191. elif [ "$2" = "v-picov" ]
  192. then
  193. cd ${IROOT}
  194. sed -i 's|"TeBkUmLpqRouter"|"TeBkUmLpqRouterPicoV"|g' ${WEB_DIR}/config/application.xml
  195. sed -i 's|EVH_SINGLE=false|EVH_SINGLE=true|g' $FFEAD_CPP_PATH/resources/server.prop
  196. for i in $(seq 0 $(($(nproc --all)-1))); do
  197. taskset -c $i ./main --server_dir=$FFEAD_CPP_PATH --server_port=8080 &
  198. done
  199. elif [ "$2" = "java-firenio" ]
  200. then
  201. cd ${IROOT}
  202. java \
  203. -server \
  204. -XX:+UseNUMA \
  205. -XX:+UseParallelGC \
  206. -XX:+AggressiveOpts \
  207. -Dlite=false \
  208. -Dcore=1 \
  209. -Dframe=16 \
  210. -DreadBuf=512 \
  211. -Dpool=true \
  212. -Ddirect=true \
  213. -Dinline=true \
  214. -Dlevel=1 \
  215. -Dread=false \
  216. -Depoll=true \
  217. -Dnodelay=true \
  218. -Dcachedurl=false \
  219. -DunsafeBuf=true \
  220. -classpath firenio-ffead-cpp-0.1-jar-with-dependencies.jar com.firenio.ffeadcpp.FirenioFfeadCppServer $FFEAD_CPP_PATH 8080
  221. elif [ "$2" = "java-rapidoid" ]
  222. then
  223. cd ${IROOT}
  224. java -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts \
  225. -classpath rapidoid-ffead-cpp-1.0-jar-with-dependencies.jar \
  226. com.rapidoid.ffeadcpp.Main $FFEAD_CPP_PATH 8080 profiles=production
  227. elif [ "$2" = "java-wizzardo-http" ]
  228. then
  229. cd ${IROOT}
  230. java -Xmx2G -Xms2G -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts \
  231. -jar wizzardo-ffead-cpp-all-1.0.jar $FFEAD_CPP_PATH 8080 env=prod
  232. elif [ "$2" = "seastar" ]
  233. then
  234. cd ${IROOT}/lang-server-backends/c++/seastar
  235. ./ffead-cpp-seastar --port=8080 --address=0.0.0.0 --fcpdir=${FFEAD_CPP_PATH} -c$(nproc)
  236. fi
  237. wait