From c9f534975d5d3f48c090342e90b573b549341408 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Thu, 15 Dec 2022 12:55:42 +0000 Subject: [PATCH 01/11] feat: add benchmark initial work --- .../docker-loadtesting-jmeter/.hadolint.yaml | 4 + .../docker-loadtesting-jmeter/LICENSE | 674 +++++++++ .../docker-loadtesting-jmeter/Makefile | 18 + .../requirements.txt | 4 + .../scripts/add_users_rdbm.py | 153 ++ .../scripts/tests/authorization_code_flow.jmx | 1315 +++++++++++++++++ .../docker-loadtesting-jmeter/version.txt | 1 + docs/admin/planning/benchmarking.md | 2 +- .../benchmark/add_sequenced_jans_user_rdbm.py | 105 -- 9 files changed, 2170 insertions(+), 106 deletions(-) create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/LICENSE create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/Makefile create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/requirements.txt create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/version.txt delete mode 100644 jans-linux-setup/tools/benchmark/add_sequenced_jans_user_rdbm.py diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml b/demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml new file mode 100644 index 00000000000..428f8174ee2 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml @@ -0,0 +1,4 @@ +ignored: + - DL3018 # Pin versions in apk add + - DL3013 # Pin versions in pip + - DL3003 # Use WORKDIR to switch to a directory diff --git a/demos/benchmarking/docker-loadtesting-jmeter/LICENSE b/demos/benchmarking/docker-loadtesting-jmeter/LICENSE new file mode 100644 index 00000000000..94a9ed024d3 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Makefile b/demos/benchmarking/docker-loadtesting-jmeter/Makefile new file mode 100644 index 00000000000..9d58bdb8bf7 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/Makefile @@ -0,0 +1,18 @@ +CN_VERSION?=1.0.0 +IMAGE_NAME=demo_loadtesting +DEV_VERSION?=$(shell echo ${CN_VERSION} | cut -d '-' -f 1)_dev + +.PHONY: test clean all build-dev trivy-scan grype-scan +.DEFAULT_GOAL := build-dev + +build-dev: + @echo "[I] Building Docker image ${IMAGE_NAME}:${DEV_VERSION}" + @docker build --rm --force-rm -t ${IMAGE_NAME}:${DEV_VERSION} . + +trivy-scan: + @echo "[I] Scanning Docker image ${IMAGE_NAME}:${DEV_VERSION} using trivy" + @trivy image --security-checks vuln ${IMAGE_NAME}:${DEV_VERSION} + +grype-scan: + @echo "[I] Scanning Docker image ${IMAGE_NAME}:${DEV_VERSION} using grype" + @grype -v ${IMAGE_NAME}:${DEV_VERSION} diff --git a/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt b/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt new file mode 100644 index 00000000000..fab1ffb179a --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt @@ -0,0 +1,4 @@ +# pinned to py3-grpcio version to avoid failure on native extension build +grpcio==1.41.0 +libcst<0.4 +git+https://github.com/JanssenProject/jans@62b82583a211ceba7abaaf4fef5a118d1dec9ef8#egg=jans-pycloudlib&subdirectory=jans-pycloudlib diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py new file mode 100644 index 00000000000..e0abfd21245 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py @@ -0,0 +1,153 @@ +# This script adds Jans users to rdbm backends + +import uuid +import os +import time +import hashlib +import base64 +import psycopg2 +import pymysql +import logging +from joblib import Parallel, delayed + + +def get_logger(name): + log_format = '%(asctime)s - %(name)8s - %(levelname)5s - %(message)s' + logging.basicConfig(level=logging.INFO, + format=log_format, + filename='setup.log', + filemode='w') + console = logging.StreamHandler() + console.setLevel(logging.INFO) + console.setFormatter(logging.Formatter(log_format)) + logging.getLogger(name).addHandler(console) + return logging.getLogger(name) + + +logger = get_logger("rdbm-user-loader") + +user_number_starting_point = int(os.environ.get("USER_NUMBER_STARTING_POINT", 0)) +user_number_ending_point = int(os.environ.get("USER_NUMBER_ENDING_POINT", 50000000)) +user_split_parallel_threads = int(os.environ.get("USER_SPLIT_PARALLEL_THREADS", 20)) +logger.info(f"Starting to add users to {os.environ.get('RDBMS_TYPE', 'mysql')}. " + f"This will add user{str(user_number_starting_point)} to user{str(user_number_ending_point)} ") + +user_id_prefix = os.environ.get("TEST_USERS_PREFIX_STRING", "test_user") +db_type = os.environ.get("RDBMS_TYPE", "mysql") +# pgsql/mysql database settings ####### +sql_host = os.environ.get("RDBMS_HOST", "localhost") +sql_db = os.environ.get("RDBMS_DB", "jans") +sql_user = os.environ.get("RDBMS_USER", "jans") +sql_password = os.environ.get("RDBMS_PASSWORD", "") +qchar = "" +schar = "" + + +def connect(): + conn = None + cur = None + if db_type == 'pgsql': + qchar = '"' + schar = '\'' + conn = psycopg2.connect(user=sql_user, + password=sql_password, + host=sql_host, + port="5432", + database=sql_db) + cur = conn.cursor() + + elif db_type == 'mysql': + qchar = '`' + schar = '"' + conn = pymysql.connect(host=sql_host, + user=sql_user, + password=sql_password, + database=sql_db, + ) + cur = conn.cursor() + + if conn: + logger.info(f"Connected to backend {db_type}") + return conn, cur + else: + logger.error(f"Could not connect to backend {db_type}") + SystemExit(1) + + +def split_interval(start, end, num_of_parts): + part_interval = (end - start) / num_of_parts + parts = [] + marker = start + + for _ in range(num_of_parts): + part = [marker, marker + part_interval] + marker += part_interval + parts.append(part) + return parts + + +def make_secret(password): + salt = os.urandom(4) + sha = hashlib.sha1(password.encode('utf-8')) + sha.update(salt) + digest_ = sha.digest() + b64encoded = base64.b64encode(digest_ + salt).decode('utf-8') + encrypted_password = '{{SSHA}}{0}'.format(b64encoded) + return encrypted_password + + +def load_users(interval): + logger.info("-------------------") + logger.info("Thread {} started!".format(str(interval))) + logger.info(time.ctime(time.time())) + logger.info("-------------------") + start = interval[0] + 1 + end = interval[1] + sql_cmds = [] + while start <= end: + inum = str(uuid.uuid4()).upper() + name = user_id_prefix + str(start) + sn = user_id_prefix + '_sn' + str(start) + dn = 'inum={},ou=people,o=jans'.format(inum) + username = name + cn = name + ' ' + sn + attributes = ( + ('doc_id', inum), + ('dn', dn), + ('objectClass', 'jansPerson'), + ('cn', cn), + ('sn', sn), + ('uid', username), + ('inum', inum), + ('jansStatus', 'active'), + ('userPassword', make_secret('topsecret' + str(int(start)))), + ('mail', username + '@jans.io'), + ('displayName', cn), + ('givenName', name), + ) + + sql_attribs = ['{0}{1}{0}'.format(qchar, a[0]) for a in attributes] + sql_vals = ['{0}{1}{0}'.format(schar, a[1]) for a in attributes] + sql_cmd = 'INSERT INTO {0}jansPerson{0} ({1}) values ({2})'.format(qchar, ','.join(sql_attribs), + ','.join(sql_vals)) + sql_cmds.append(sql_cmd) + start += 1 + conn, cur = connect() + for cmd in sql_cmds: + try: + cur.execute(cmd) + conn.commit() + except Exception as e: + logger.error(e) + conn.close() + logger.info("-------------------") + logger.info(time.ctime(time.time())) + logger.info("Thread {} Ended!".format(str(interval))) + logger.info("-------------------") + + +def main(): + user_numbers_intervals = split_interval(user_number_starting_point, user_number_ending_point, + user_split_parallel_threads) + results = Parallel(n_jobs=-1, backend="multiprocessing")( + map(delayed(load_users), user_numbers_intervals)) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx new file mode 100644 index 00000000000..90af1292378 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -0,0 +1,1315 @@ + + + + + + false + true + + + + host + https://FQDN + = + + + scope + openid profile email user_name + = + + + username + admin + = + + + password + 7IiUu*5/HA8H + = + + + redirect_uri + https://FQDN/ + = + + + client_id + AUTHZ_CLIENT_ID + = + + + client_secret + AUTHZ_CLIENT_SECRET + = + + + client_header + to_override_in_jsr223 + = + + + location_regexp + Location: https:\/\/FQDN_PART1\.FQDN_PART2\.FQDN_PART3(.*) + = + + + + + + + + + + + ${host} + + 60000 + 60000 + https + + + HttpClient4 + 6 + + + + continue + + false + 1 + + 1 + 1 + 1479823133000 + 1479823133000 + false + + + true + + + + + + true + false + false + + + + + true + + + + 1 + + 1 + session_state_counter + + false + + + + + + + true + ${scope} + = + true + scope + + + false + code + = + true + response_type + + + false + nonce + = + true + nonce + + + true + ${redirect_uri} + = + true + redirect_uri + + + true + ${client_id} + = + true + client_id + + + + + + + + https + + /jans-auth/restv1/authorize + GET + true + false + false + false + HttpClient4 + false + + + + + false + javax.faces.FormSignature + <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> + $1$ + + + + + + false + javax.faces.ViewState + <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> + $1$ + + + + + + false + usernameField + <input id="loginForm:username" name="(.+?)" type="text" + $1$ + UNKNOWN + 1 + + + + false + userpasswordField + <input id="loginForm:password" name="(.+?)" type="password" + $1$ + UNKNOWN + 1 + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + + + false + loginForm + loginForm + = + true + + + true + loginForm:username + ${username} + = + true + + + true + loginForm:password + ${password} + = + true + + + true + loginForm:loginButton + Login + = + true + + + true + jakarta.faces.ViewState + stateless + = + true + + + false + {"description":"Chrome 67.0.3396.99 on Windows Server 2008 R2 / 7 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36","version":"67.0","os":{"architecture":64,"family":"Windows Server 2008 R2 / 7","version":"7"}} + = + true + loginForm:platform + + + + + 443 + + + https + UTF-8 + /jans-auth/login.htm + POST + false + false + false + false + HttpClient4 + false + + Detected the start of a redirect chain + + + + + + Content-Type + application/x-www-form-urlencoded + + + Accept-Language + en-US,en;q=0.5 + + + Accept + text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 + + + User-Agent + Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 + + + Referer + https://${host}/oxauth/login + + + Accept-Encoding + gzip, deflate + + + + + + java + + + true + double weight = 0.7d; + +int min = FIRST_BATCH_MIN; +int max = FIRST_BATCH_MAX; + +int minX = SECOND_BATCH_MIN; +int maxX = SECOND_BATCH_MAX; + +float chance = new Random().nextFloat(); +if (chance <= weight) { + min = minX; + max = maxX; +} + +int userNumber = new Random().nextInt(max - min + 1) + min; +String username = "TEST_USERS_PREFIX_STRING" + userNumber; + +//log.info("username: " + username); + +vars.put("username", username); + +log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + true + redirect_to + ${location_regexp} + $1$ + NOT_FOUND + 1 + all + + + + false + true + true + false + + + + + true + 2 + + + + + + + + 443 + + + + + ${redirect_to} + GET + false + false + true + false + false + + + + + true + redirect_to + ${location_regexp} + $1$ + NOT_FOUND + 1 + all + + + + true + + + String code = ""; +String redirectTo = vars.get("redirect_to"); +if (redirectTo.contains("?code=")) { + code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "?code="); +} else { + code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "&code="); +} +if (code.contains("&")) { + code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); +} + +vars.put("code", code); +log.info("login post processor, code : " + code + ", redirect_to:" + redirectTo); + + java + + + + true + true + true + true + + + + + + + + + false + ${code} + = + true + code + + + false + authorization_code + = + true + grant_type + + + false + ${redirect_uri} + = + true + redirect_uri + + + + + + + + + + /jans-auth/restv1/token + POST + true + false + false + false + HttpClient4 + false + + + + + + + Authorization + ${client_header} + + + Content-Type + application/x-www-form-urlencoded + + + + + + true + + + String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); +String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); +log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); +OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); +vars.put("client_header", clientHeader); + java + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + "access_token" + + Assertion.response_data + false + 2 + + + + + access_token + $.access_token + + + + + id_token + $.id_token + + + + + + + + + false + ${access_token} + = + true + access_token + + + + + + + + + + /jans-auth/restv1/userinfo + POST + true + false + false + false + HttpClient4 + false + + + + + + + Content-Type + application/x-www-form-urlencoded + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + java + + + true + import org.apache.jmeter.protocol.http.control.CookieManager; +import org.apache.jmeter.protocol.http.control.Cookie; +import org.apache.jmeter.testelement.property.JMeterProperty; +import org.apache.jmeter.testelement.property.CollectionProperty; + +CookieManager manager = sampler.getCookieManager(); +CollectionProperty collectionProperty = manager.getCookies(); +log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); + +Object session_state_counter = vars.get("session_state_counter"); +log.info("session_state_counter : " + session_state_counter); + +for (int i = 0; i < collectionProperty.size(); i++) { + JMeterProperty p = collectionProperty.get(i); + + if ("session_state".equals(p.getName())) { + //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); + props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); + props.put("oic.id_token." + session_state_counter, vars.get("id_token")); + log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); + log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); + } +} + + + + + + + + + + 60000 + 60000 + + + + 6 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + + continue + + false + -1 + + 1 + 1 + 1480924764000 + 1480924764000 + false + + 3 + true + + + + + false + + + + 3000 + + + + + + + false + ${id_token} + = + true + id_token_hint + + + + + + + + + + + GET + true + false + true + false + false + + + + + java + + + true + import org.apache.jmeter.protocol.http.control.CookieManager; +import org.apache.jmeter.protocol.http.control.Cookie; + +CookieManager manager = sampler.getCookieManager(); + +for (Map.Entry entry : props.entrySet()) { + if (entry.getKey() instanceof String) { + String key = entry.getKey(); + if (key.startsWith("oic.session_state.")) { + String counter = key.substring("oic.session_state.".length()); + + log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); + + Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); + manager.add(cookie); + + Object idToken = props.getProperty("oic.id_token." + counter); + log.info("PRE end session, id_token : " + idToken); + vars.put("id_token", idToken); + + props.remove("oic.session_state." + counter); + props.remove("oic.id_token." + counter); + break; + } + } +} + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + continue + + false + 1 + + 2000 + 5 + 1482159304000 + 1482159304000 + false + + + true + + + + + true + + + + + + Authorization + ${client_header} + + + Content-Type + application/x-www-form-urlencoded + + + + + + java + + + true + String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); +String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); +log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); +OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); +vars.put("client_header", clientHeader); + + + + + + + false + client_credentials + = + true + grant_type + + + false + ${client_id} + = + true + client_id + + + false + ${scope} + = + true + scope + + + + + + + + + + /oxauth/restv1/token + POST + true + false + true + false + false + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/version.txt b/demos/benchmarking/docker-loadtesting-jmeter/version.txt new file mode 100644 index 00000000000..3eefcb9dd5b --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/version.txt @@ -0,0 +1 @@ +1.0.0 diff --git a/docs/admin/planning/benchmarking.md b/docs/admin/planning/benchmarking.md index 677f515b3e7..237b7288e55 100644 --- a/docs/admin/planning/benchmarking.md +++ b/docs/admin/planning/benchmarking.md @@ -64,7 +64,7 @@ justified. 1. Create users by pattern: 1. username: `test_user1`, `test_user2`, ... `test_userN` 1. secret: `test_user_password` - Following script can be used [add_sequenced_jans_user_rdbm.py](https://github.com/JanssenProject/jans/tree/main/jans-linux-setup/tools/benchmark/add_sequenced_jans_user_rdbm.py) + Following script can be used [add_sequenced_jans_user_rdbm.py](https://github.com/JanssenProject/jans/tree/main/demos/benchmarking/scripts/add_users_rdbm.py) **User Selection Logic** diff --git a/jans-linux-setup/tools/benchmark/add_sequenced_jans_user_rdbm.py b/jans-linux-setup/tools/benchmark/add_sequenced_jans_user_rdbm.py deleted file mode 100644 index f81cf83d45a..00000000000 --- a/jans-linux-setup/tools/benchmark/add_sequenced_jans_user_rdbm.py +++ /dev/null @@ -1,105 +0,0 @@ -# This script adds Jans users to rdbm backends - -import sys -import uuid -import json -import random -import os -import hashlib -import base64 -import psycopg2 -import pymysql - -# Set number of users to be created -N = 100 - -#Users ID's will start with this string, e.g., test_user1, test_user2, test_user3 ... -userId = 'test_user' - -# All users will have this password -userSecret = 'test_user_password' - -# Set either pgsql or mysql -db_type = 'mysql' - -# pgsql/mysql database settings ####### -sql_host = 'localhost' -sql_db = 'jansdb' -sql_user = 'jans' -sql_password = 'w5IWm03tT7Za' -######################################## - - -if db_type == 'pgsql': - qchar = '"' - schar = '\'' - conn = psycopg2.connect(user=sql_user, - password=sql_password, - host=sql_host, - port="5432", - database=sql_db) - cur = conn.cursor() - -elif db_type == 'mysql': - qchar = '`' - schar = '"' - conn = pymysql.connect(host=sql_host, - user=sql_user, - password=sql_password, - database=sql_db, - ) - cur = conn.cursor() - -def make_secret(password): - - salt = os.urandom(4) - sha = hashlib.sha1(password.encode('utf-8')) - sha.update(salt) - digest_ = sha.digest() - b64encoded = base64.b64encode(digest_+salt).decode('utf-8') - encrypted_password = '{{SSHA}}{0}'.format(b64encoded) - return encrypted_password - -user_secret_ssha = make_secret(userSecret) - - -i = 0 -while i < N: - i += 1 - inum = str(uuid.uuid4()).upper() - name = userId + str(i) - sn = userId + '_sn' + str(i) - - dn='inum={},ou=people,o=jans'.format(inum) - - username = name - cn = name + ' ' + sn - - attributes= ( - ('doc_id', inum), - ('dn', dn), - ('objectClass', 'jansPerson'), - ('cn', cn), - ('sn', sn), - ('uid', username), - ('inum', inum), - ('jansStatus', 'active'), - ('userPassword', user_secret_ssha), - ('mail', username+'@jans.io'), - ('displayName', cn), - ('givenName', name), - ) - - - sql_attribs = ['{0}{1}{0}'.format(qchar, a[0]) for a in attributes] - sql_vals = ['{0}{1}{0}'.format(schar, a[1]) for a in attributes] - sql_cmd = 'INSERT INTO {0}jansPerson{0} ({1}) values ({2})'.format(qchar, ','.join(sql_attribs), ','.join(sql_vals)) - - if db_type in ('pgsql', 'mysql'): - cur.execute(sql_cmd) - conn.commit() - print("Added", username) - - -if db_type in ('pgsql', 'mysql'): - conn.close() From 86798054ad2547bdc3a9e80e7470f191df3258b1 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Thu, 15 Dec 2022 12:58:13 +0000 Subject: [PATCH 02/11] feat: add benchmark initial work --- .../docker-loadtesting-jmeter/.dockerignore | 11 + .../docker-loadtesting-jmeter/.gitattributes | 2 + .../docker-loadtesting-jmeter/.gitignore | 105 ++ .../docker-loadtesting-jmeter/Dockerfile | 77 + .../docker-loadtesting-jmeter/README.md | 2 + .../scripts/add_users_couchbase.py | 108 ++ .../scripts/add_users_ldap.py | 119 ++ .../scripts/add_users_spanner.py | 147 ++ .../scripts/entrypoint.sh | 77 + .../scripts/tests/authorization_code.jmx | 1314 +++++++++++++++++ .../scripts/tests/ropc.jmx | 590 ++++++++ .../yaml/load_test.yaml | 51 + .../yaml/load_users_couchbase_job.yaml | 46 + .../yaml/load_users_spanner_job.yaml | 58 + 14 files changed, 2707 insertions(+) create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/.dockerignore create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/.gitattributes create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/.gitignore create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/Dockerfile create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/README.md create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.dockerignore b/demos/benchmarking/docker-loadtesting-jmeter/.dockerignore new file mode 100644 index 00000000000..1203624c052 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/.dockerignore @@ -0,0 +1,11 @@ +# exclude everything +* + +# include required files/directories +!certs +!conf +!jetty +!libs +!scripts +!LICENSE +!requirements.txt diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.gitattributes b/demos/benchmarking/docker-loadtesting-jmeter/.gitattributes new file mode 100644 index 00000000000..dfe0770424b --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.gitignore b/demos/benchmarking/docker-loadtesting-jmeter/.gitignore new file mode 100644 index 00000000000..afad62b59bd --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/.gitignore @@ -0,0 +1,105 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# PyCharm project settings +.idea +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +.DS_STORE \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile new file mode 100644 index 00000000000..0f455e4d396 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile @@ -0,0 +1,77 @@ +FROM blazemeter/taurus:master-f96971fa-2022-12-12 + +# =============== +# Ubuntu packages +# =============== + +RUN apt-get clean \ +&& mv /var/lib/apt/lists /tmp \ +&& mkdir -p /var/lib/apt/lists/partial \ +&& apt-get clean + +RUN apt-get update \ + && apt-get install openjdk-8-jre-headless wget git bash python3-dev lsb-core python3-setuptools cmake build-essential apt-utils python3-pip -y + +# =============== +# Environmental Variables +# =============== + +ENV FQDN="https://example.jans.io" \ + AUTHZ_CLIENT_ID="" \ + AUTHZ_CLIENT_SECRET="" \ + ROPC_CLIENT_ID="" \ + ROPC_CLIENT_SECRET="test_ro_client_password" \ + FIRST_BATCH_MIN=0 \ + FIRST_BATCH_MAX=5000000 \ + SECOND_BATCH_MIN=5000001\ + SECOND_BATCH_MAX=50000000 \ + RUN_AUTHZ_TEST=false \ + RUN_ROPC_TEST=false \ + TEST_USERS_PREFIX_STRING="test_user" \ + COUCHBASE_URL="" \ + COUCHBASE_PW="" \ + USER_NUMBER_STARTING_POINT=0 \ + USER_NUMBER_ENDING_POINT=50000000 \ + LOAD_USERS_TO_COUCHBASE="" \ + LOAD_USERS_TO_LDAP="" \ + LOAD_USERS_TO_SPANNER="" \ + GOOGLE_APPLICATION_CREDENTIALS=""\ + GOOGLE_PROJECT_ID=""\ + GOOGLE_SPANNER_INSTANCE_ID=""\ + GOOGLE_SPANNER_DATABASE_ID=""\ + LDAP_URL="" \ + LDAP_PW="" \ + LDAP_DN="" \ + # pgsql or mysql + RDBMS_TYPE="" \ + RDBMS_DB="" \ + RDBMS_USER="" \ + RDBMS_PASSWORD="" \ + RDBMS_HOST="" + +# =============== +# Install Couchbase Client +# =============== + +RUN apt-get update \ + && python3 -m pip install couchbase + +# ======================= +# Install Spanner package +# ======================= + +RUN python3 -m pip install google-cloud-spanner + +# =============== +# Packages +# =============== +RUN pip install joblib ldap3 pygtail + +COPY scripts /scripts + +RUN mkdir -p /root/.bzt/jmeter-taurus \ + && wget -q https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.tgz -O /scripts/apache-jmeter-5.5.tgz \ + && tar zxvf /scripts/pache-jmeter-5.5.tgz -C /root/.bzt/jmeter-taurus \ + && mv /root/.bzt/jmeter-taurus/apache-jmeter-5.5 /root/.bzt/jmeter-taurus/5.5 + +ENTRYPOINT ["bash", "/scripts/entrypoint.sh"] diff --git a/demos/benchmarking/docker-loadtesting-jmeter/README.md b/demos/benchmarking/docker-loadtesting-jmeter/README.md new file mode 100644 index 00000000000..9f6b1f79330 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/README.md @@ -0,0 +1,2 @@ +# docker-loadtesting-jmeter + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py new file mode 100644 index 00000000000..621abddfc4e --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py @@ -0,0 +1,108 @@ +import base64 +import os +import hashlib +import uuid +import time +import logging +from couchbase.cluster import Cluster, ClusterOptions +from couchbase.cluster import PasswordAuthenticator +from joblib import Parallel, delayed + +def get_logger(name): + log_format = '%(asctime)s - %(name)8s - %(levelname)5s - %(message)s' + logging.basicConfig(level=logging.INFO, + format=log_format, + filename='setup.log', + filemode='w') + console = logging.StreamHandler() + console.setLevel(logging.INFO) + console.setFormatter(logging.Formatter(log_format)) + logging.getLogger(name).addHandler(console) + return logging.getLogger(name) + + +logger = get_logger("cb-user-loader") + +user_number_starting_point = int(os.environ.get("USER_NUMBER_STARTING_POINT", 0)) +user_number_ending_point = int(os.environ.get("USER_NUMBER_ENDING_POINT", 50000000)) +user_split_parallel_threads = int(os.environ.get("USER_SPLIT_PARALLEL_THREADS", 20)) +user_id_prefix = os.environ.get("TEST_USERS_PREFIX_STRING", "test_user") +logger.info("Starting to add users to Couchbase. This will add user{} to user{} ".format( + str(user_number_starting_point), str(user_number_ending_point))) +couchbase_url = os.environ.get("COUCHBASE_URL", "cb.cbns.svc.cluster.local") +couchbase_pw = os.environ.get("COUCHBASE_PW", "Test1234#") + +cluster = Cluster('couchbase://' + couchbase_url, ClusterOptions(PasswordAuthenticator('admin', couchbase_pw))) +cb = cluster.bucket('jans_user') + + +def split_interval(start, end, num_of_parts): + part_interval = (end - start) / num_of_parts + parts = [] + marker = start + + for _ in range(num_of_parts): + part = [marker, marker + part_interval] + marker += part_interval + parts.append(part) + return parts + + +def make_secret(password): + salt = os.urandom(4) + sha = hashlib.sha1(password.encode('utf-8')) + sha.update(salt) + digest_ = sha.digest() + b64encoded = base64.b64encode(digest_ + salt).decode('utf-8') + encrypted_password = '{{SSHA}}{0}'.format(b64encoded) + return encrypted_password + + +def load_users(interval): + logger.info("-------------------") + logger.info("Thread {} started!".format(str(interval))) + logger.info(time.ctime(time.time())) + logger.info("-------------------") + start = interval[0] + 1 + end = interval[1] + while start <= end: + inum = str(uuid.uuid4()) + name = '{}{}'.format(user_id_prefix, int(start)) + sn = 'lastname{}'.format(int(start)) + dn = "inum={0},ou=people,o=jans".format(inum) + key = 'people_' + inum + cn = name + ' ' + sn + + user_data = { + "userPassword": make_secret('topsecret' + str(int(start))), + "mail": name + '@jans.io', + "displayName": name + ' ' + sn, + "givenName": name, + "objectClass": "jansPerson", + "dn": dn, + "cn": cn, + "inum": inum, + "uid": name, + "jansStatus": "active", + "sn": sn + } + try: + cb.insert(key, user_data) + except Exception as e: + logger.error(e) + start += 1 + logger.info("-------------------") + logger.info(time.ctime(time.time())) + logger.info("Thread {} Ended!".format(str(interval))) + logger.info("-------------------") + + +def main(): + user_numbers_intervals = split_interval(user_number_starting_point, user_number_ending_point, + user_split_parallel_threads) + results = Parallel(n_jobs=-1, backend="multiprocessing")( + map(delayed(load_users), user_numbers_intervals)) + + +if __name__ == "__main__": + main() diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py new file mode 100644 index 00000000000..8564da18086 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py @@ -0,0 +1,119 @@ +from ldap3 import Server, Connection, MODIFY_REPLACE, MODIFY_ADD, MODIFY_DELETE, SUBTREE, ALL, BASE, LEVEL +import base64 +import os +import hashlib +import uuid +import time +import logging +from joblib import Parallel, delayed + + +def get_logger(name): + log_format = '%(asctime)s - %(name)8s - %(levelname)5s - %(message)s' + logging.basicConfig(level=logging.INFO, + format=log_format, + filename='setup.log', + filemode='w') + console = logging.StreamHandler() + console.setLevel(logging.INFO) + console.setFormatter(logging.Formatter(log_format)) + logging.getLogger(name).addHandler(console) + return logging.getLogger(name) + + +logger = get_logger("ldap-user-loader") + +user_number_starting_point = int(os.environ.get("USER_NUMBER_STARTING_POINT", 0)) +user_number_ending_point = int(os.environ.get("USER_NUMBER_ENDING_POINT", 50000000)) +user_split_parallel_threads = int(os.environ.get("USER_SPLIT_PARALLEL_THREADS", 20)) +user_id_prefix = os.environ.get("TEST_USERS_PREFIX_STRING", "test_user") +logger.info("Starting to add users to LDAP. This will add user{} to user{} ".format(str(user_number_starting_point), + str(user_number_ending_point))) +bind_dn = os.environ.get("LDAP_DN", "cn=directory manager") +ldapPass = os.environ.get("LDAP_PW", "Test1234#") +ldap_host = os.environ.get("LDAP_URL", "opendj:1636") + + +def connect(): + ldap_server = Server(ldap_host, port=1636, use_ssl=True) + ldap_conn = Connection(ldap_server, user=bind_dn, password=ldapPass) + conn_bool = ldap_conn.bind() + + if conn_bool: + logger.info("Connected to backend LDAP") + return ldap_conn + else: + logger.error("Could not connect to backend LDAP") + SystemExit(1) + + +def split_interval(start, end, num_of_parts): + part_interval = (end - start) / num_of_parts + parts = [] + marker = start + + for _ in range(num_of_parts): + part = [marker, marker + part_interval] + marker += part_interval + parts.append(part) + return parts + + +def make_secret(password): + salt = os.urandom(4) + sha = hashlib.sha1(password.encode('utf-8')) + sha.update(salt) + digest_ = sha.digest() + b64encoded = base64.b64encode(digest_ + salt).decode('utf-8') + encrypted_password = '{{SSHA}}{0}'.format(b64encoded) + return encrypted_password + + +def load_users(interval): + ldap_conn = connect() + logger.info("-------------------") + logger.info("Thread {} started!".format(str(interval))) + logger.info(time.ctime(time.time())) + logger.info("-------------------") + start = interval[0] + 1 + end = interval[1] + while start <= end: + inum = str(uuid.uuid4()) + name = '{}{}'.format(user_id_prefix, int(start)) + sn = 'lastname{}'.format(int(start)) + dn = "inum={0},ou=people,o=jans".format(inum) + key = 'people_' + inum + cn = name + ' ' + sn + + user_data = { + "userPassword": make_secret('topsecret' + str(int(start))), + "mail": name + '@jans.io', + "displayName": name + ' ' + sn, + "givenName": name, + 'objectClass': ['top', 'jansPerson'], + "cn": cn, + "inum": inum, + "uid": name, + "jansStatus": "active", + "sn": sn + } + try: + ldap_conn.add(dn, attributes=user_data) + except Exception as e: + logger.error(e) + start += 1 + logger.info("-------------------") + logger.info(time.ctime(time.time())) + logger.info("Thread {} Ended!".format(str(interval))) + logger.info("-------------------") + + +def main(): + user_numbers_intervals = split_interval(user_number_starting_point, user_number_ending_point, + user_split_parallel_threads) + results = Parallel(n_jobs=-1, backend="multiprocessing")( + map(delayed(load_users), user_numbers_intervals)) + + +if __name__ == "__main__": + main() diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py new file mode 100644 index 00000000000..c17a97db210 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py @@ -0,0 +1,147 @@ +""" + +The following envvars are required: + +- ``GOOGLE_APPLICATION_CREDENTIALS``: Path to JSON file contains + Google credentials +- ``GOOGLE_PROJECT_ID``: (a.k.a Google project ID) +- ``GOOGLE_SPANNER_INSTANCE_ID``: Spanner instance ID +- ``GOOGLE_SPANNER_DATABASE_ID``: Spanner database ID +""" + +import base64 +import os +import hashlib +import uuid +import time +import logging +from google.cloud import spanner +from joblib import Parallel, delayed +from contextlib import suppress + + +def get_logger(name): + log_format = '%(asctime)s - %(name)8s - %(levelname)5s - %(message)s' + logging.basicConfig(level=logging.INFO, + format=log_format, + filename='setup.log', + filemode='w') + console = logging.StreamHandler() + console.setLevel(logging.INFO) + console.setFormatter(logging.Formatter(log_format)) + logging.getLogger(name).addHandler(console) + return logging.getLogger(name) + + +logger = get_logger("spanner-user-loader") +cred_file = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", "/etc/certs/google-service-account.json") +user_number_starting_point = int(os.environ.get("USER_NUMBER_STARTING_POINT", 0)) +user_number_ending_point = int(os.environ.get("USER_NUMBER_ENDING_POINT", 50000000)) +user_split_parallel_threads = int(os.environ.get("USER_SPLIT_PARALLEL_THREADS", 20)) +user_id_prefix = os.environ.get("TEST_USERS_PREFIX_STRING", "test_user") +logger.info("Starting to add users to Spanner. This will add user{} to user{} ".format( + str(user_number_starting_point), str(user_number_ending_point))) +project_id = os.environ.get("GOOGLE_PROJECT_ID", "") +client = spanner.Client(project=project_id) +instance_id = os.environ.get("GOOGLE_SPANNER_INSTANCE_ID", "cn-test") +instance = client.instance(instance_id) + +database_id = os.environ.get("GOOGLE_SPANNER_DATABASE_ID", "load") +database = instance.database(database_id) + + +def connected(): + """Check whether connection is alive by executing simple query. + """ + + cntr = 0 + with database.snapshot() as snapshot: + result = snapshot.execute_sql("SELECT 1") + with suppress(IndexError): + row = list(result)[0] + cntr = row[0] + return cntr > 0 + + +def split_interval(start, end, num_of_parts): + part_interval = (end - start) / num_of_parts + parts = [] + marker = start + + for _ in range(num_of_parts): + part = [marker, marker + part_interval] + marker += part_interval + parts.append(part) + return parts + + +def make_secret(password): + salt = os.urandom(4) + sha = hashlib.sha1(password.encode('utf-8')) + sha.update(salt) + digest_ = sha.digest() + b64encoded = base64.b64encode(digest_ + salt).decode('utf-8') + encrypted_password = '{{SSHA}}{0}'.format(b64encoded) + return encrypted_password + + +def load_users(interval): + columns = ['userPassword', 'mail', 'displayName', 'givenName', 'objectClass', 'dn', + 'cn', 'inum', 'doc_id', 'uid', 'jansStatus', 'sn'] + logger.info("-------------------") + logger.info("Thread {} started!".format(str(interval))) + logger.info("Preparing query {} started!".format(str(interval))) + logger.info(time.ctime(time.time())) + logger.info("-------------------") + start = interval[0] + 1 + end = interval[1] + while start <= end: + values = [] + inum = str(uuid.uuid4()) + name = '{}{}'.format(user_id_prefix, int(start)) + sn = 'lastname{}'.format(int(start)) + dn = "inum={0},ou=people,o=jans".format(inum) + cn = name + ' ' + sn + people = [ + make_secret('topsecret' + str(int(start))), + name + '@jans.io', + name + ' ' + sn, + name, + "jansPerson", + dn, + cn, + inum, + inum, + name, + "active", + sn + ] + values.append(people) + try: + with database.batch() as batch: + batch.insert(table='jansPerson', columns=columns, values=values) + except Exception as e: + logger.error(e) + start += 1 + logger.info("-------------------") + logger.info(time.ctime(time.time())) + logger.info("Thread {} Ended!".format(str(interval))) + logger.info("-------------------") + +def main(): + test_spanner_connection = connected() + if not test_spanner_connection: + raise Exception("Spanner backend is unreachable") + # The transaction contains too many mutations. Insert and update operations count with the multiplicity of the + # number of columns they affect. For example, inserting values into one key column and four non-key columns count + # as five mutations total for the insert. Delete and delete range operations count as one mutation regardless of + # the number of columns affected. The total mutation count includes any changes to indexes that the transaction + # generates. Please reduce the number of writes, or use fewer indexes. (Maximum number: 20000) + user_numbers_intervals = split_interval(user_number_starting_point, user_number_ending_point, + user_split_parallel_threads) + results = Parallel(n_jobs=-1, backend="multiprocessing")( + map(delayed(load_users), user_numbers_intervals)) + + +if __name__ == "__main__": + main() diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh new file mode 100644 index 00000000000..f79e4303159 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -0,0 +1,77 @@ +#!/bin/bash +set -e + +# ================================================================================================ # +# Check if this is a user loading job to the backend couchbase # +# ================================================================================================ # + +if [[ "${LOAD_USERS_TO_COUCHBASE}" == "true" ]]; then + /usr/bin/python3 /scripts/add_users_couchbase.py + exit 0 +fi + +# ================================================================================================ # +# Check if this is a user loading job to the backend ldap # +# ================================================================================================ # + +if [[ "${LOAD_USERS_TO_LDAP}" == "true" ]]; then + /usr/bin/python3 /scripts/add_users_ldap.py + exit 0 +fi + +# ================================================================================================ # +# Check if this is a user loading job to the backend spanner # +# ================================================================================================ # + +if [[ "${LOAD_USERS_TO_SPANNER}" == "true" ]]; then + /usr/bin/python3 /scripts/add_users_spanner.py + exit 0 +fi + +# ================================================================================================ # +# Check if this is a user loading job to the backend spanner # +# ================================================================================================ # + +if [[ "${LOAD_USERS_TO_SPANNER}" == "true" ]]; then + /usr/bin/python3 /scripts/add_users_spanner.py + exit 0 +fi + + +replace_all() { + IFS='.' read -ra FQDN_PARTS <<< "$FQDN" + sed "s#FQDN#$FQDN#g" \ + | sed "s#AUTHZ_CLIENT_ID#$AUTHZ_CLIENT_ID#g" \ + | sed "s#ROPC_CLIENT_ID#$ROPC_CLIENT_ID#g" \ + | sed "s#AUTHZ_CLIENT_SECRET#$AUTHZ_CLIENT_SECRET#g" \ + | sed "s#ROPC_CLIENT_SECRET#$ROPC_CLIENT_SECRET#g" \ + | sed "s#FQDN_PART1#${FQDN_PARTS[1]}#g" \ + | sed "s#FQDN_PART2#${FQDN_PARTS[2]}#g" \ + | sed "s#FQDN_PART3#${FQDN_PARTS[3]}#g" \ + | sed "s#FIRST_BATCH_MIN#$FIRST_BATCH_MIN#g" \ + | sed "s#FIRST_BATCH_MAX#$FIRST_BATCH_MAX#g" \ + | sed "s#SECOND_BATCH_MIN#$SECOND_BATCH_MIN#g" \ + | sed "s#SECOND_BATCH_MAX#$SECOND_BATCH_MAX#g" \ + | sed "s#TEST_USERS_PREFIX_STRING#$TEST_USERS_PREFIX_STRING#g" + +} + +cat /scripts/tests/authorization_code_flow.jmx | replace_all > tmpfile && mv tmpfile /scripts/authorization_code_flow.jmx +cat /scripts/tests/ropc.jmx | replace_all > tmpfile && mv tmpfile /scripts/ropc.jmx + +if [ "$RUN_AUTHZ_TEST" == "true" ] +then + echo "Authentication code flow is activated." + # Add -o modules.console.disable=true to disable TUI + bzt /scripts/tests/authorization_code_flow.jmx + exit 0 +fi + +if [ "$RUN_ROPC_TEST" == "true" ] +then + echo "Resource owner password credential grant flow is activated." + # Add -o modules.console.disable=true to disable TUI + bzt /scripts/tests/ropc.jmx + exit 0 +fi + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx new file mode 100644 index 00000000000..e5cea9f2c35 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx @@ -0,0 +1,1314 @@ + + + + + + false + true + + + + host + FQDN + = + + + scope + openid profile email user_name + = + + + username + user1 + = + + + password + topsecret + = + + + redirect_uri + https://FQDN/identity/authcode.htm + = + + + client_id + AUTHZ_CLIENT_ID + = + + + client_secret + AUTHZ_CLIENT_SECRET + = + + + client_header + to_override_in_jsr223 + = + + + location_regexp + Location: https:\/\/FQDN_PART1\.FQDN_PART2\.FQDN_PART3(.*) + = + + + + + + + + + + + ${host} + + https + + + 6 + HttpClient4 + 60000 + 60000 + + + + continue + + false + -1 + + 200 + 10 + 1479823133000 + 1479823133000 + false + + + + + + + + true + false + + + + + true + + + + 1 + + 1 + session_state_counter + + false + + + + + + + true + ${scope} + = + true + scope + + + false + code + = + true + response_type + + + false + nonce + = + true + nonce + + + true + ${redirect_uri} + = + true + redirect_uri + + + true + ${client_id} + = + true + client_id + + + + + + https + + /oxauth/restv1/authorize + GET + true + false + false + false + + HttpClient4 + + + + + + false + javax.faces.FormSignature + <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> + $1$ + + + + + + false + javax.faces.ViewState + <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> + $1$ + + + + + + false + usernameField + <input id="loginForm:username" name="(.+?)" type="text" + $1$ + UNKNOWN + 1 + + + + false + userpasswordField + <input id="loginForm:password" name="(.+?)" type="password" + $1$ + UNKNOWN + 1 + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + true + true + false + + + + + + + + false + loginForm + loginForm + = + true + + + true + loginForm:username + ${username} + = + true + + + true + loginForm:password + ${password} + = + true + + + true + loginForm:loginButton + + = + true + + + true + javax.faces.ViewState + stateless + = + true + + + false + {"description":"Chrome 67.0.3396.99 on Windows Server 2008 R2 / 7 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36","version":"67.0","os":{"architecture":64,"family":"Windows Server 2008 R2 / 7","version":"7"}} + = + true + loginForm:platform + + + + + 443 + https + UTF-8 + /oxauth/login.htm + POST + false + false + false + false + + HttpClient4 + + + Detected the start of a redirect chain + + + + + + Content-Type + application/x-www-form-urlencoded + + + Accept-Language + en-US,en;q=0.5 + + + Accept + text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 + + + User-Agent + Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 + + + Referer + https://${host}/oxauth/login + + + Accept-Encoding + gzip, deflate + + + + + + java + + + true + double weight = 0.7d; + +// 10% +int min = FIRST_BATCH_MIN; +int max = FIRST_BATCH_MAX; + +// 90% +int maxX = SECOND_BATCH_MIN; +int maxY = SECOND_BATCH_MAX; + +float chance = new Random().nextFloat(); +if (chance <= weight) { + min = maxX; + max = maxY; +} + +int userNumber = new Random().nextInt(max - min + 1) + min; +String username = "TEST_USERS_PREFIX_STRING" + userNumber; +String password = "topsecret" + userNumber; + +//log.info("username: " + username); + +vars.put("username", username); +vars.put("password", password); + +log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + true + redirect_to + ${location_regexp} + $1$ + NOT_FOUND + 1 + all + + + + false + true + true + false + + + + + true + 2 + + + + + + + + 443 + + + ${redirect_to} + GET + false + false + false + false + + + + + + + true + redirect_to + ${location_regexp} + $1$ + NOT_FOUND + 1 + all + + + + true + + + String code = ""; +String redirectTo = vars.get("redirect_to"); +if (redirectTo.contains("?code=")) { + code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "?code="); +} else { + code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "&code="); +} +if (code.contains("&")) { + code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); +} + +vars.put("code", code); +log.info("login post processor, code : " + code + ", redirect_to:" + redirectTo); + + java + + + + true + true + true + true + + + + + + + + + false + ${code} + = + true + code + + + false + authorization_code + = + true + grant_type + + + false + ${redirect_uri} + = + true + redirect_uri + + + + + + + + /oxauth/restv1/token + POST + true + false + false + false + + HttpClient4 + + + + + + + + Authorization + ${client_header} + + + Content-Type + application/x-www-form-urlencoded + + + + + + true + + + String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); +String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); +log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); +vars.put("client_header", clientHeader); + java + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + "access_token" + + Assertion.response_data + false + 2 + + + + + access_token + $.access_token + + + + + id_token + $.id_token + + + + + + + + + false + ${access_token} + = + true + access_token + + + + + + + + /oxauth/restv1/userinfo + POST + true + false + false + false + + HttpClient4 + + + + + + + + Content-Type + application/x-www-form-urlencoded + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + java + + + true + import org.apache.jmeter.protocol.http.control.CookieManager; +import org.apache.jmeter.protocol.http.control.Cookie; +import org.apache.jmeter.testelement.property.JMeterProperty; +import org.apache.jmeter.testelement.property.CollectionProperty; + +CookieManager manager = sampler.getCookieManager(); +CollectionProperty collectionProperty = manager.getCookies(); +log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); + +Object session_state_counter = vars.get("session_state_counter"); +log.info("session_state_counter : " + session_state_counter); + +for (int i = 0; i < collectionProperty.size(); i++) { + JMeterProperty p = collectionProperty.get(i); + + if ("session_state".equals(p.getName())) { + //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); + props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); + props.put("oic.id_token." + session_state_counter, vars.get("id_token")); + log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); + log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); + } +} + + + + + + + + + + + + + 6 + 60000 + 60000 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + + continue + + false + -1 + + 1 + 1 + 1480924764000 + 1480924764000 + false + + 3 + + + + + false + + + + 3000 + + + + + + + false + ${id_token} + = + true + id_token_hint + + + + + + + + + GET + true + false + true + false + + + + + + + java + + + true + import org.apache.jmeter.protocol.http.control.CookieManager; +import org.apache.jmeter.protocol.http.control.Cookie; + +CookieManager manager = sampler.getCookieManager(); + +for (Map.Entry entry : props.entrySet()) { + if (entry.getKey() instanceof String) { + String key = entry.getKey(); + if (key.startsWith("oic.session_state.")) { + String counter = key.substring("oic.session_state.".length()); + + log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); + + Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); + manager.add(cookie); + + Object idToken = props.getProperty("oic.id_token." + counter); + log.info("PRE end session, id_token : " + idToken); + vars.put("id_token", idToken); + + props.remove("oic.session_state." + counter); + props.remove("oic.id_token." + counter); + break; + } + } +} + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + continue + + false + 1 + + 2000 + 5 + 1482159304000 + 1482159304000 + false + + + + + + + true + + + + + + Authorization + ${client_header} + + + Content-Type + application/x-www-form-urlencoded + + + + + + java + + + true + String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); +String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); +log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); +OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); +vars.put("client_header", clientHeader); + + + + + + + false + client_credentials + = + true + grant_type + + + false + ${client_id} + = + true + client_id + + + false + ${scope} + = + true + scope + + + + + + + + /oxauth/restv1/token + POST + true + false + true + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx new file mode 100644 index 00000000000..0cd37d42f98 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx @@ -0,0 +1,590 @@ + + + + + + false + true + + + + host + FQDN + = + + + username + user350101 + = + + + password + topsecret + = + + + client_id + ROPC_CLIENT_ID + = + + + client_secret + ROPC_CLIENT_SECRET + = + + + client_header + to_override_in_jsr223 + = + + + + + + + + + + + ${host} + + https + + + 6 + HttpClient4 + 60000 + 60000 + + + + continue + + false + -1 + + 1 + 1 + 1479823133000 + 1479823133000 + false + + + + + + + + true + false + + + + + + + true + grant_type + password + = + true + + + true + username + ${username} + = + true + + + true + password + ${password} + = + true + + + true + ${client_id} + = + true + client_id + + + true + ${client_secret} + = + true + client_secret + + + + + 443 + https + UTF-8 + /oxauth/restv1/token + POST + false + false + true + false + + HttpClient4 + + + Detected the start of a redirect chain + + + + + + Content-Type + application/x-www-form-urlencoded + + + Accept-Language + en-US,en;q=0.5 + + + Accept + text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 + + + User-Agent + Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 + + + Referer + https://${host}/oxauth/login + + + Accept-Encoding + gzip, deflate + + + Authorization_disabled + Basic ${client_header} + + + + + + java + + + true + double weight = 0.7d; + +// 10% +int min = FIRST_BATCH_MIN; +int max = FIRST_BATCH_MAX; + +// 90% +int maxX = SECOND_BATCH_MIN; +int maxY = SECOND_BATCH_MAX; + +float chance = new Random().nextFloat(); +if (chance <= weight) { + min = maxX; + max = maxY; +} + +int userNumber = new Random().nextInt(max - min + 1) + min; +String username = "user" + userNumber; +String password = "topsecret" + userNumber; + +//log.info("username: " + username); + +vars.put("username", username); +vars.put("password", password); + +log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); + + + + + java + + + true + import org.apache.commons.codec.binary.Base64; + +String clientCredentials = vars.get("client_id") + ":" + vars.get("client_secret"); +String clientCredentialsEncoded = Base64.encodeBase64String(clientCredentials.getBytes()); + +vars.put("client_header", clientCredentialsEncoded); + +log.info("client_header: " + vars.get("client_header")); + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + true + true + false + + + + + + + + + + + + + 6 + 60000 + 60000 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml new file mode 100644 index 00000000000..74de9386c40 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml @@ -0,0 +1,51 @@ +apiVersion: v1 +data: + AUTHZ_CLIENT_ID: 1001.21beb9f2-e8de-4b10-949f-5cf31a28f95b # Saved from steps above + AUTHZ_CLIENT_SECRET: FWLmNKmVcQZt # Saved from steps above + # First batch is the users from min - max that login 10% every time + FIRST_BATCH_MAX: "5000000" + FIRST_BATCH_MIN: "0" + # Second batch is the users from min - max that login 90% every time + SECOND_BATCH_MAX: "50000000" + SECOND_BATCH_MIN: "5000001" + FQDN: demoexample.jans.io + ROPC_CLIENT_ID: c1b9628e-84f5-43e6-bf00-b341543703d9 # Saved from steps above + ROPC_CLIENT_SECRET: test_ro_client_password # Saved from steps above + RUN_AUTHZ_TEST: "true" # or "false" + RUN_ROPC_TEST: "true" # or "false" +kind: ConfigMap +metadata: + labels: + app: load-testing + name: load-testing-cm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: load-testing + name: load-testing +spec: + replicas: 1 + selector: + matchLabels: + app: load-testing + template: + metadata: + labels: + app: load-testing + spec: + containers: + - envFrom: + - configMapRef: + name: load-testing-cm + image: janssenproject/demo_loadtesting:1.0.0_dev + imagePullPolicy: Always + name: load-testing + resources: + requests: + memory: "4000Mi" + cpu: "4000m" + limits: + memory: "4000Mi" + cpu: "4000m" \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml new file mode 100644 index 00000000000..2082e94e298 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml @@ -0,0 +1,46 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: load-users + name: load-users-cm +data: + COUCHBASE_PW: Test1234# + COUCHBASE_URL: cb.cbns.svc.cluster.local + LOAD_USERS_TO_COUCHBASE: "true" + LOAD_USERS_TO_LDAP: "false" + NUMBERS_OF_USERS_TO_LOAD: "500000000" + LDAP_URL: "opendj:1636" + LDAP_PW: Test1234# + LDAP_DN: "cn=directory manager" +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: load-users + name: load-users +spec: + template: + metadata: + labels: + app: load-users + spec: + hostAliases: + - ip: NGINX_IP + hostnames: + - FQDN + containers: + - envFrom: + - configMapRef: + name: load-users-cm + image: janssenproject/demo_loadtesting:1.0.0_dev + name: load-users + resources: + limits: + cpu: 10000m + memory: 5000Mi + requests: + cpu: 10000m + memory: 5000Mi + restartPolicy: Never diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml new file mode 100644 index 00000000000..b9c44a0e0bd --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml @@ -0,0 +1,58 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: load-users + name: load-users-cm +data: + GOOGLE_APPLICATION_CREDENTIALS: '/etc/certs/google_service_account.json' + GOOGLE_PROJECT_ID: cb.cbns.svc.cluster.local + GOOGLE_SPANNER_INSTANCE_ID: "cn-test" + GOOGLE_SPANNER_DATABASE_ID: "test" + LOAD_USERS_TO_SPANNER: "true" + LOAD_USERS_TO_LDAP: "false" + LOAD_USERS_TO_COUCHBASE: "false" + NUMBERS_OF_USERS_TO_LOAD: "500000000" + LDAP_URL: "opendj:1636" + LDAP_PW: Test1234# + LDAP_DN: "cn=directory manager" +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: load-users + name: load-users +spec: + backoffLimit: 1 + template: + metadata: + labels: + app: load-users + spec: + hostAliases: + - ip: NGINX_IP + hostnames: + - FQDN + volumes: + - name: google-sa + secret: + secretName: google-sa + containers: + - envFrom: + - configMapRef: + name: load-users-cm + image: janssenproject/demo_loadtesting:1.0.0_dev + volumeMounts: + - mountPath: /etc/jans/conf/google-credentials.json + name: google-sa + subPath: google-credentials.json + name: load-users + resources: + limits: + cpu: 30000m + memory: 60000Mi + requests: + cpu: 30000m + memory: 60000Mi + restartPolicy: Never From 744e4db5e1c22f39d1438a8eaee771e3ca42bdc5 Mon Sep 17 00:00:00 2001 From: YuriyZ Date: Thu, 15 Dec 2022 15:17:45 +0200 Subject: [PATCH 03/11] test: jmeter - use "topsecret" + number for generated password --- .../scripts/tests/authorization_code_flow.jmx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx index 90af1292378..38989dcec85 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -353,10 +353,12 @@ if (chance <= weight) { int userNumber = new Random().nextInt(max - min + 1) + min; String username = "TEST_USERS_PREFIX_STRING" + userNumber; +String password = "topsecret" + userNumber; //log.info("username: " + username); vars.put("username", username); +vars.put("password", password); log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); From 2e8cdf3dbf449f6b8da40e61f2d218cfd350fb87 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:54:08 +0000 Subject: [PATCH 04/11] fix: missing envs --- .../docker-loadtesting-jmeter/Dockerfile | 5 ++- .../scripts/add_users_rdbm.py | 9 +++- .../scripts/entrypoint.sh | 27 ++++------- .../yaml/load_users_rdbms_job.yaml | 45 +++++++++++++++++++ 4 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile index 0f455e4d396..de2ce6e9d8b 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile +++ b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile @@ -35,6 +35,7 @@ ENV FQDN="https://example.jans.io" \ LOAD_USERS_TO_COUCHBASE="" \ LOAD_USERS_TO_LDAP="" \ LOAD_USERS_TO_SPANNER="" \ + LOAD_USERS_TO_RDBMS="" \ GOOGLE_APPLICATION_CREDENTIALS=""\ GOOGLE_PROJECT_ID=""\ GOOGLE_SPANNER_INSTANCE_ID=""\ @@ -65,13 +66,13 @@ RUN python3 -m pip install google-cloud-spanner # =============== # Packages # =============== -RUN pip install joblib ldap3 pygtail +RUN pip install joblib ldap3 pygtail psycopg2 PyMySQL COPY scripts /scripts RUN mkdir -p /root/.bzt/jmeter-taurus \ && wget -q https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.tgz -O /scripts/apache-jmeter-5.5.tgz \ - && tar zxvf /scripts/pache-jmeter-5.5.tgz -C /root/.bzt/jmeter-taurus \ + && tar zxvf /scripts/apache-jmeter-5.5.tgz -C /root/.bzt/jmeter-taurus \ && mv /root/.bzt/jmeter-taurus/apache-jmeter-5.5 /root/.bzt/jmeter-taurus/5.5 ENTRYPOINT ["bash", "/scripts/entrypoint.sh"] diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py index e0abfd21245..8713b7a8732 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py @@ -106,8 +106,8 @@ def load_users(interval): sql_cmds = [] while start <= end: inum = str(uuid.uuid4()).upper() - name = user_id_prefix + str(start) - sn = user_id_prefix + '_sn' + str(start) + name = user_id_prefix + str(int(start)) + sn = user_id_prefix + '_sn' + str(int(start)) dn = 'inum={},ou=people,o=jans'.format(inum) username = name cn = name + ' ' + sn @@ -138,6 +138,7 @@ def load_users(interval): cur.execute(cmd) conn.commit() except Exception as e: + logger.error(f"{cmd} did not execute!") logger.error(e) conn.close() logger.info("-------------------") @@ -151,3 +152,7 @@ def main(): user_split_parallel_threads) results = Parallel(n_jobs=-1, backend="multiprocessing")( map(delayed(load_users), user_numbers_intervals)) + + +if __name__ == "__main__": + main() diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh index f79e4303159..0509f7c2d0f 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -4,40 +4,29 @@ set -e # ================================================================================================ # # Check if this is a user loading job to the backend couchbase # # ================================================================================================ # - -if [[ "${LOAD_USERS_TO_COUCHBASE}" == "true" ]]; then +if [[ "$LOAD_USERS_TO_COUCHBASE" = "true" ]]; then /usr/bin/python3 /scripts/add_users_couchbase.py exit 0 -fi - # ================================================================================================ # # Check if this is a user loading job to the backend ldap # # ================================================================================================ # - -if [[ "${LOAD_USERS_TO_LDAP}" == "true" ]]; then +elif [[ "$LOAD_USERS_TO_LDAP" = "true" ]]; then /usr/bin/python3 /scripts/add_users_ldap.py exit 0 -fi - # ================================================================================================ # # Check if this is a user loading job to the backend spanner # # ================================================================================================ # - -if [[ "${LOAD_USERS_TO_SPANNER}" == "true" ]]; then +elif [[ "$LOAD_USERS_TO_SPANNER" = "true" ]]; then /usr/bin/python3 /scripts/add_users_spanner.py exit 0 -fi - # ================================================================================================ # -# Check if this is a user loading job to the backend spanner # +# Check if this is a user loading job to the backend RDBMS # # ================================================================================================ # - -if [[ "${LOAD_USERS_TO_SPANNER}" == "true" ]]; then - /usr/bin/python3 /scripts/add_users_spanner.py +elif [[ "$LOAD_USERS_TO_RDBMS" = "true" ]]; then + /usr/bin/python3 /scripts/add_users_rdbm.py exit 0 fi - replace_all() { IFS='.' read -ra FQDN_PARTS <<< "$FQDN" sed "s#FQDN#$FQDN#g" \ @@ -59,7 +48,7 @@ replace_all() { cat /scripts/tests/authorization_code_flow.jmx | replace_all > tmpfile && mv tmpfile /scripts/authorization_code_flow.jmx cat /scripts/tests/ropc.jmx | replace_all > tmpfile && mv tmpfile /scripts/ropc.jmx -if [ "$RUN_AUTHZ_TEST" == "true" ] +if [[ "$RUN_AUTHZ_TEST" = "true" ]] then echo "Authentication code flow is activated." # Add -o modules.console.disable=true to disable TUI @@ -67,7 +56,7 @@ then exit 0 fi -if [ "$RUN_ROPC_TEST" == "true" ] +if [[ "$RUN_ROPC_TEST" = "true" ]] then echo "Resource owner password credential grant flow is activated." # Add -o modules.console.disable=true to disable TUI diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml new file mode 100644 index 00000000000..81ea29402e2 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml @@ -0,0 +1,45 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: load-users + name: load-users-cm +data: + LOAD_USERS_TO_RDBMS: "true" + RDBMS_TYPE: 'mysql' + RDBMS_DB: "jans" + RDBMS_USER: "root" + RDBMS_PASSWORD: Test1234# + RDBMS_HOST: "my-release-mysql.mysql.svc.cluster.local" + NUMBERS_OF_USERS_TO_LOAD: "500000000" +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: load-users + name: load-users +spec: + template: + metadata: + labels: + app: load-users + spec: + hostAliases: + - ip: NGINX_IP + hostnames: + - FQDN + containers: + - envFrom: + - configMapRef: + name: load-users-cm + image: janssenproject/demo_loadtesting:1.0.0_dev + name: load-users + resources: + limits: + cpu: 10000m + memory: 5000Mi + requests: + cpu: 10000m + memory: 5000Mi + restartPolicy: Never From 73ac183864a9560f0c027e07ea6946e170cdc88d Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Wed, 21 Dec 2022 14:10:23 +0000 Subject: [PATCH 05/11] fix: parsing the authz jmx --- .../scripts/add_users_rdbm.py | 14 ++++++++------ .../scripts/entrypoint.sh | 8 ++++---- .../scripts/tests/authorization_code_flow.jmx | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py index 8713b7a8732..401c2112cd0 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py @@ -39,16 +39,20 @@ def get_logger(name): sql_db = os.environ.get("RDBMS_DB", "jans") sql_user = os.environ.get("RDBMS_USER", "jans") sql_password = os.environ.get("RDBMS_PASSWORD", "") -qchar = "" -schar = "" + +if db_type == 'pgsql': + qchar = '"' + schar = '\'' + +elif db_type == 'mysql': + qchar = '`' + schar = '"' def connect(): conn = None cur = None if db_type == 'pgsql': - qchar = '"' - schar = '\'' conn = psycopg2.connect(user=sql_user, password=sql_password, host=sql_host, @@ -57,8 +61,6 @@ def connect(): cur = conn.cursor() elif db_type == 'mysql': - qchar = '`' - schar = '"' conn = pymysql.connect(host=sql_host, user=sql_user, password=sql_password, diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh index 0509f7c2d0f..bf6bcd501b1 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -29,14 +29,14 @@ fi replace_all() { IFS='.' read -ra FQDN_PARTS <<< "$FQDN" - sed "s#FQDN#$FQDN#g" \ - | sed "s#AUTHZ_CLIENT_ID#$AUTHZ_CLIENT_ID#g" \ + sed "s#AUTHZ_CLIENT_ID#$AUTHZ_CLIENT_ID#g" \ | sed "s#ROPC_CLIENT_ID#$ROPC_CLIENT_ID#g" \ | sed "s#AUTHZ_CLIENT_SECRET#$AUTHZ_CLIENT_SECRET#g" \ | sed "s#ROPC_CLIENT_SECRET#$ROPC_CLIENT_SECRET#g" \ | sed "s#FQDN_PART1#${FQDN_PARTS[1]}#g" \ | sed "s#FQDN_PART2#${FQDN_PARTS[2]}#g" \ | sed "s#FQDN_PART3#${FQDN_PARTS[3]}#g" \ + | sed "s#FQDN#$FQDN#g" \ | sed "s#FIRST_BATCH_MIN#$FIRST_BATCH_MIN#g" \ | sed "s#FIRST_BATCH_MAX#$FIRST_BATCH_MAX#g" \ | sed "s#SECOND_BATCH_MIN#$SECOND_BATCH_MIN#g" \ @@ -52,7 +52,7 @@ if [[ "$RUN_AUTHZ_TEST" = "true" ]] then echo "Authentication code flow is activated." # Add -o modules.console.disable=true to disable TUI - bzt /scripts/tests/authorization_code_flow.jmx + bzt /scripts/authorization_code_flow.jmx exit 0 fi @@ -60,7 +60,7 @@ if [[ "$RUN_ROPC_TEST" = "true" ]] then echo "Resource owner password credential grant flow is activated." # Add -o modules.console.disable=true to disable TUI - bzt /scripts/tests/ropc.jmx + bzt /scripts/ropc.jmx exit 0 fi diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx index 38989dcec85..ced75d25bd1 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -9,7 +9,7 @@ host - https://FQDN + FQDN = @@ -29,7 +29,7 @@ redirect_uri - https://FQDN/ + https://FQDN = From 0966bf043988c9d61a7d5e2e5cd2aeabb9525960 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Thu, 22 Dec 2022 09:48:58 +0000 Subject: [PATCH 06/11] fix: parsing the authz jmx --- .../docker-loadtesting-jmeter/scripts/entrypoint.sh | 6 +++--- .../scripts/tests/authorization_code_flow.jmx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh index bf6bcd501b1..8fdd14b2e68 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -33,9 +33,9 @@ replace_all() { | sed "s#ROPC_CLIENT_ID#$ROPC_CLIENT_ID#g" \ | sed "s#AUTHZ_CLIENT_SECRET#$AUTHZ_CLIENT_SECRET#g" \ | sed "s#ROPC_CLIENT_SECRET#$ROPC_CLIENT_SECRET#g" \ - | sed "s#FQDN_PART1#${FQDN_PARTS[1]}#g" \ - | sed "s#FQDN_PART2#${FQDN_PARTS[2]}#g" \ - | sed "s#FQDN_PART3#${FQDN_PARTS[3]}#g" \ + | sed "s#FQDN_PART1#${FQDN_PARTS[0]}#g" \ + | sed "s#FQDN_PART2#${FQDN_PARTS[1]}#g" \ + | sed "s#FQDN_PART3#${FQDN_PARTS[2]}#g" \ | sed "s#FQDN#$FQDN#g" \ | sed "s#FIRST_BATCH_MIN#$FIRST_BATCH_MIN#g" \ | sed "s#FIRST_BATCH_MAX#$FIRST_BATCH_MAX#g" \ diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx index ced75d25bd1..0e7071baeef 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -78,8 +78,8 @@ false 1 - 1 - 1 + 200 + 10 1479823133000 1479823133000 false From 1ca4251ab2888046d689bd77b3ca10740e85956f Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:03:41 +0000 Subject: [PATCH 07/11] fix: adjust jmx --- .../docker-loadtesting-jmeter/Dockerfile | 3 +- .../docker-loadtesting-jmeter/README.md | 35 +++++++++++++++++-- .../scripts/entrypoint.sh | 1 + .../scripts/tests/authorization_code_flow.jmx | 17 +++++---- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile index de2ce6e9d8b..7701a48c0bc 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile +++ b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update \ # Environmental Variables # =============== -ENV FQDN="https://example.jans.io" \ +ENV FQDN="https://demoexample.jans.io" \ AUTHZ_CLIENT_ID="" \ AUTHZ_CLIENT_SECRET="" \ ROPC_CLIENT_ID="" \ @@ -28,6 +28,7 @@ ENV FQDN="https://example.jans.io" \ RUN_AUTHZ_TEST=false \ RUN_ROPC_TEST=false \ TEST_USERS_PREFIX_STRING="test_user" \ + THREADCOUNT=200 \ COUCHBASE_URL="" \ COUCHBASE_PW="" \ USER_NUMBER_STARTING_POINT=0 \ diff --git a/demos/benchmarking/docker-loadtesting-jmeter/README.md b/demos/benchmarking/docker-loadtesting-jmeter/README.md index 9f6b1f79330..1dbab777c76 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/README.md +++ b/demos/benchmarking/docker-loadtesting-jmeter/README.md @@ -1,2 +1,33 @@ -# docker-loadtesting-jmeter - +## Overview + +Docker Load Test image packaging for Janssen. This image can load test users to a janssen environment and can execute jmeter tests. + +## Pre-requisites + +- [Docker](https://docs.docker.com/install) + +## Environment Variables + +Installation depends on the set of environment variables shown below. These environment variables can be set to customize installation as per the need. If not set, the installer uses default values. + +| ENV | Description | Default | +|----------------------------|--------------------------------------------------|--------------------------------------------------| +| `FQDN` | Hostname to install janssen with. | `https://demoexample.jans.io` | +| `AUTHZ_CLIENT_ID` | Password of the admin user. | `1t5Fin3#security` | +| `AUTHZ_CLIENT_SECRET` | Organization name. Used for ssl cert generation. | `Janssen` | +| `ROPC_CLIENT_ID` | Email. Used for ssl cert generation. | `support@jans.io` | +| `ROPC_CLIENT_SECRET` | City. Used for ssl cert generation. | `Austin` | +| `FIRST_BATCH_MIN` | State. Used for ssl cert generation | `TX` | +| `FIRST_BATCH_MAX` | Country. Used for ssl cert generation. | `US` | +| `SECOND_BATCH_MIN` | **NOT SUPPORRTED YET** | `false` | +| `SECOND_BATCH_MAX` | Installs the Config API service. | `true` | +| `RUN_AUTHZ_TEST` | Installs the SCIM API service. | `true` | +| `RUN_ROPC_TEST` | Installs the FIDO2 API service. | `true` | +| `TEST_USERS_PREFIX_STRING` | MySQL jans database. | `jans` | +| `THREADCOUNT` | MySQL database user. | `jans` | +| `COUCHBASE_URL` | MySQL database user password. | `1t5Fin3#security` | +| `COUCHBASE_PW` | MySQL host. | `mysql` which is the docker compose service name | + + +## How to run + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh index 8fdd14b2e68..d4c7d547f50 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -41,6 +41,7 @@ replace_all() { | sed "s#FIRST_BATCH_MAX#$FIRST_BATCH_MAX#g" \ | sed "s#SECOND_BATCH_MIN#$SECOND_BATCH_MIN#g" \ | sed "s#SECOND_BATCH_MAX#$SECOND_BATCH_MAX#g" \ + | sed "s#THREADCOUNT#$THREADCOUNT#g" \ | sed "s#TEST_USERS_PREFIX_STRING#$TEST_USERS_PREFIX_STRING#g" } diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx index 0e7071baeef..415f78e8d12 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -19,12 +19,12 @@ username - admin + user1 = password - 7IiUu*5/HA8H + topsecret = @@ -76,16 +76,15 @@ continue false - 1 + -1 - 200 + THREADCOUNT 10 1479823133000 1479823133000 false - true @@ -185,7 +184,7 @@ - + false usernameField <input id="loginForm:username" name="(.+?)" type="text" @@ -194,7 +193,7 @@ 1 - + false userpasswordField <input id="loginForm:password" name="(.+?)" type="password" @@ -339,9 +338,11 @@ true double weight = 0.7d; +// 10% int min = FIRST_BATCH_MIN; int max = FIRST_BATCH_MAX; +// 90% int minX = SECOND_BATCH_MIN; int maxX = SECOND_BATCH_MAX; @@ -910,7 +911,6 @@ for (int i = 0; i < collectionProperty.size(); i++) { false 3 - true @@ -1168,7 +1168,6 @@ for (Map.Entry entry : props.entrySet()) { false - true From 0b9febe811c221835f0ed968a8f631bddd21bb6b Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Mon, 26 Dec 2022 11:21:40 +0000 Subject: [PATCH 08/11] docs: add envs description --- .../docker-loadtesting-jmeter/Dockerfile | 29 +- .../docker-loadtesting-jmeter/README.md | 130 +++- .../scripts/add_users_ldap.py | 2 +- .../scripts/add_users_spanner.py | 4 +- .../scripts/entrypoint.sh | 14 +- .../scripts/tests/authorization_code_flow.jmx | 2 +- ...> resource_owner_password_credentials.jmx} | 447 ++----------- .../scripts/tests/ropc.jmx | 590 ------------------ .../load_test_auth_code.yaml} | 25 +- .../load_users_couchbase_job.yaml | 21 +- .../yaml/load-users/load_users_ldap_job.yaml | 43 ++ .../load_users_rdbms_job.yaml | 17 +- .../load_users_spanner_job.yaml | 28 +- docs/admin/planning/benchmarking.md | 77 ++- 14 files changed, 327 insertions(+), 1102 deletions(-) rename demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/{authorization_code.jmx => resource_owner_password_credentials.jmx} (67%) delete mode 100644 demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx rename demos/benchmarking/docker-loadtesting-jmeter/yaml/{load_test.yaml => load-test/load_test_auth_code.yaml} (61%) rename demos/benchmarking/docker-loadtesting-jmeter/yaml/{ => load-users}/load_users_couchbase_job.yaml (68%) create mode 100644 demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml rename demos/benchmarking/docker-loadtesting-jmeter/yaml/{ => load-users}/load_users_rdbms_job.yaml (74%) rename demos/benchmarking/docker-loadtesting-jmeter/yaml/{ => load-users}/load_users_spanner_job.yaml (66%) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile index 7701a48c0bc..72d4e81a024 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile +++ b/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile @@ -20,36 +20,33 @@ ENV FQDN="https://demoexample.jans.io" \ AUTHZ_CLIENT_ID="" \ AUTHZ_CLIENT_SECRET="" \ ROPC_CLIENT_ID="" \ - ROPC_CLIENT_SECRET="test_ro_client_password" \ - FIRST_BATCH_MIN=0 \ - FIRST_BATCH_MAX=5000000 \ - SECOND_BATCH_MIN=5000001\ - SECOND_BATCH_MAX=50000000 \ + ROPC_CLIENT_SECRET="" \ RUN_AUTHZ_TEST=false \ RUN_ROPC_TEST=false \ TEST_USERS_PREFIX_STRING="test_user" \ - THREADCOUNT=200 \ + THREAD_COUNT=200 \ COUCHBASE_URL="" \ COUCHBASE_PW="" \ USER_NUMBER_STARTING_POINT=0 \ USER_NUMBER_ENDING_POINT=50000000 \ - LOAD_USERS_TO_COUCHBASE="" \ - LOAD_USERS_TO_LDAP="" \ - LOAD_USERS_TO_SPANNER="" \ - LOAD_USERS_TO_RDBMS="" \ + LOAD_USERS_TO_COUCHBASE=false \ + LOAD_USERS_TO_LDAP=false \ + LOAD_USERS_TO_SPANNER=false \ + LOAD_USERS_TO_RDBMS=false \ + USER_SPLIT_PARALLEL_THREADS=20 \ GOOGLE_APPLICATION_CREDENTIALS=""\ GOOGLE_PROJECT_ID=""\ GOOGLE_SPANNER_INSTANCE_ID=""\ GOOGLE_SPANNER_DATABASE_ID=""\ - LDAP_URL="" \ + LDAP_URL="opendj:1636" \ LDAP_PW="" \ - LDAP_DN="" \ + LDAP_DN="cn=directory manager" \ # pgsql or mysql - RDBMS_TYPE="" \ - RDBMS_DB="" \ - RDBMS_USER="" \ + RDBMS_TYPE="mysql" \ + RDBMS_DB="jans" \ + RDBMS_USER="jans" \ RDBMS_PASSWORD="" \ - RDBMS_HOST="" + RDBMS_HOST="localhost" # =============== # Install Couchbase Client diff --git a/demos/benchmarking/docker-loadtesting-jmeter/README.md b/demos/benchmarking/docker-loadtesting-jmeter/README.md index 1dbab777c76..cc51db76de4 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/README.md +++ b/demos/benchmarking/docker-loadtesting-jmeter/README.md @@ -8,26 +8,118 @@ Docker Load Test image packaging for Janssen. This image can load test users to ## Environment Variables -Installation depends on the set of environment variables shown below. These environment variables can be set to customize installation as per the need. If not set, the installer uses default values. - -| ENV | Description | Default | -|----------------------------|--------------------------------------------------|--------------------------------------------------| -| `FQDN` | Hostname to install janssen with. | `https://demoexample.jans.io` | -| `AUTHZ_CLIENT_ID` | Password of the admin user. | `1t5Fin3#security` | -| `AUTHZ_CLIENT_SECRET` | Organization name. Used for ssl cert generation. | `Janssen` | -| `ROPC_CLIENT_ID` | Email. Used for ssl cert generation. | `support@jans.io` | -| `ROPC_CLIENT_SECRET` | City. Used for ssl cert generation. | `Austin` | -| `FIRST_BATCH_MIN` | State. Used for ssl cert generation | `TX` | -| `FIRST_BATCH_MAX` | Country. Used for ssl cert generation. | `US` | -| `SECOND_BATCH_MIN` | **NOT SUPPORRTED YET** | `false` | -| `SECOND_BATCH_MAX` | Installs the Config API service. | `true` | -| `RUN_AUTHZ_TEST` | Installs the SCIM API service. | `true` | -| `RUN_ROPC_TEST` | Installs the FIDO2 API service. | `true` | -| `TEST_USERS_PREFIX_STRING` | MySQL jans database. | `jans` | -| `THREADCOUNT` | MySQL database user. | `jans` | -| `COUCHBASE_URL` | MySQL database user password. | `1t5Fin3#security` | -| `COUCHBASE_PW` | MySQL host. | `mysql` which is the docker compose service name | +Installation depends on the set of environment variables shown below. These environment variables can be set to customize loading users and testing. + +## Parameters + +### Loading users + +| ENV | Description | Default | +|----------------------------------|---------------------------------------------------------------------------------------------------------------|------------------------| +| `TEST_USERS_PREFIX_STRING` | The user prefix string attached to the test users loaded | `test_user` | +| `COUCHBASE_URL` | Couchbase URL if Couchbase is the persistence to load users in. | `` | +| `COUCHBASE_PW` | Couchbase PW if Couchbase is the persistence to load users in. | `` | +| `USER_NUMBER_STARTING_POINT` | The user number to start from . This is appended to the username i.e test_user0 | `0` | +| `USER_NUMBER_ENDING_POINT` | The user number to end at. | `50000000` | +| `LOAD_USERS_TO_COUCHBASE` | Enable loading users to Couchbase persistence. `true` or `false` == `` | `false` | +| `LOAD_USERS_TO_LDAP` | Enable loading users to LDAP persistence. `true` or `false` == `` | `false` | +| `LOAD_USERS_TO_SPANNER` | Enable loading users to Spanner persistence. `true` or `false` == `` | `false` | +| `LOAD_USERS_TO_RDBMS` | Enable loading users to RDBMS persistence. `true` or `false` == `` | `false` | +| `USER_SPLIT_PARALLEL_THREADS` | The number of parallel threads to break the total number users across. This number heavily effects CPU usage. | `20` | +| `GOOGLE_APPLICATION_CREDENTIALS` | Google Credentials JSON SA file. **Used with Spanner** | `` | +| `GOOGLE_PROJECT_ID` | Google Project ID. **Used with Spanner** | `` | +| `GOOGLE_SPANNER_INSTANCE_ID` | Google Spanner Instance ID. **Used with Spanner** | `` | +| `GOOGLE_SPANNER_DATABASE_ID` | Google Spanner Database ID. **Used with Spanner** | `` | +| `LDAP_URL` | LDAP URL if LDAP is the persistence to load users in. | `opendj:1636` | +| `LDAP_PW` | LDAP PW if LDAP is the persistence to load users in. | `` | +| `LDAP_DN` | LDAP DN if LDAP is the persistence to load users in. | `cn=directory manager` | +| `RDBMS_TYPE` | RDBMS type if `mysql` or `pgsql` is the persistence to load users in. | `mysql` | +| `RDBMS_DB` | RDBMS Database name if `mysql` or `pgsql` is the persistence to load users in. | `jans` | +| `RDBMS_USER` | RDBMS user if `mysql` or `pgsql` is the persistence to load users in. | `jans` | +| `RDBMS_PASSWORD` | RDBMS user password if `mysql` or `pgsql` is the persistence to load users in. . | `` | +| `RDBMS_HOST` | RDBMS host if `mysql` or `pgsql` is the persistence to load users in. | `localhost` | + +### Running tests + +| ENV | Description | Default | +|----------------------------------|-----------------------------------------------------------------|--------------------------------------------------| +| `FQDN` | The hostname janssen is using. | `https://demoexample.jans.io` | +| `AUTHZ_CLIENT_ID` | Authorization code client id | `` | +| `AUTHZ_CLIENT_SECRET` | Authorization code client secret | `` | +| `ROPC_CLIENT_ID` | Resource grant client id | `` | +| `ROPC_CLIENT_SECRET` | Resource grant client secret | `` | +| `RUN_AUTHZ_TEST` | Run the Authorization code test | `false` | +| `RUN_ROPC_TEST` | Run the ROPC test | `false` | +| `TEST_USERS_PREFIX_STRING` | The user prefix string attached to the test users loaded | `test_user` | +| `THREAD_COUNT` | Thread count in jmeter tests | `200` | ## How to run +### Kubernetes + +#### Loading users + +Edit the custom connection values and other envs for the file `load_users__job.yaml` found in the [yaml](./yaml/load-users) folder and run : + +```bash +kubectl apply -f load_users__job.yaml +``` + +Wait for the job to finish before running any tests. + +#### Running tests + +##### Authorization code flow + +1. Create the client needed to run the test by executing the following. Make sure to change the `FQDN` : + +```bash +cat << EOF > auth_code_client.json +{ + "dn": null, + "inum": null, + "displayName": "Auth Code Flow Load Test Client", + "redirectUris": [ + "https://FQDN" + ], + "responseTypes": [ + "id_token", + "code" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token" + ], + "tokenEndpointAuthMethod": "client_secret_basic", + "scopes": [ + "openid", + "profile", + "email", + "user_name" + ], + "trustedClient": true, + "includeClaimsInIdToken": false, + "accessTokenAsJwt": false, + "disabled": false, + "deletable": false, + "description": "Auth Code Flow Load Testing Client" +} +EOF +``` + +Download or build [config-cli-tui](../../../jans-cli-tui) and run: + +```bash +# add -noverify if your fqdn is not registered +./config-cli-tui.pyz --host --client-id --client-secret --no-tui --operation-id=post-oauth-openid-client --data=auth_code_client.json +``` + +Save the client id and secret from the response and enter them along with any custom property in the yaml [file](yaml/load-test/load_test_auth_code.yaml) then execute : + +```bash +kubectl apply -f load_test_auth_code.yaml +``` + + diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py index 8564da18086..507120072fe 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py @@ -30,7 +30,7 @@ def get_logger(name): logger.info("Starting to add users to LDAP. This will add user{} to user{} ".format(str(user_number_starting_point), str(user_number_ending_point))) bind_dn = os.environ.get("LDAP_DN", "cn=directory manager") -ldapPass = os.environ.get("LDAP_PW", "Test1234#") +ldapPass = os.environ.get("LDAP_PW", "") ldap_host = os.environ.get("LDAP_URL", "opendj:1636") diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py index c17a97db210..001012b2380 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py @@ -43,10 +43,10 @@ def get_logger(name): str(user_number_starting_point), str(user_number_ending_point))) project_id = os.environ.get("GOOGLE_PROJECT_ID", "") client = spanner.Client(project=project_id) -instance_id = os.environ.get("GOOGLE_SPANNER_INSTANCE_ID", "cn-test") +instance_id = os.environ.get("GOOGLE_SPANNER_INSTANCE_ID", "") instance = client.instance(instance_id) -database_id = os.environ.get("GOOGLE_SPANNER_DATABASE_ID", "load") +database_id = os.environ.get("GOOGLE_SPANNER_DATABASE_ID", "") database = instance.database(database_id) diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh index d4c7d547f50..e39a4fe4bd5 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh @@ -27,7 +27,15 @@ elif [[ "$LOAD_USERS_TO_RDBMS" = "true" ]]; then exit 0 fi + replace_all() { + users_range=$(((USER_NUMBER_ENDING_POINT-USER_NUMBER_STARTING_POINT))) + FIRST_BATCH_MIN=USER_NUMBER_STARTING_POINT + SECOND_BATCH_MAX=USER_NUMBER_ENDING_POINT + FIRST_BATCH_MAX=$((((USER_NUMBER_STARTING_POINT*10)/100))) + SECOND_BATCH_MIN=$((FIRST_BATCH_MAX+1)) + SECOND_BATCH_MAX=$(((((USER_NUMBER_STARTING_POINT*10)/100)+1))) + IFS='.' read -ra FQDN_PARTS <<< "$FQDN" sed "s#AUTHZ_CLIENT_ID#$AUTHZ_CLIENT_ID#g" \ | sed "s#ROPC_CLIENT_ID#$ROPC_CLIENT_ID#g" \ @@ -41,13 +49,13 @@ replace_all() { | sed "s#FIRST_BATCH_MAX#$FIRST_BATCH_MAX#g" \ | sed "s#SECOND_BATCH_MIN#$SECOND_BATCH_MIN#g" \ | sed "s#SECOND_BATCH_MAX#$SECOND_BATCH_MAX#g" \ - | sed "s#THREADCOUNT#$THREADCOUNT#g" \ + | sed "s#THREAD_COUNT#$THREAD_COUNT#g" \ | sed "s#TEST_USERS_PREFIX_STRING#$TEST_USERS_PREFIX_STRING#g" } cat /scripts/tests/authorization_code_flow.jmx | replace_all > tmpfile && mv tmpfile /scripts/authorization_code_flow.jmx -cat /scripts/tests/ropc.jmx | replace_all > tmpfile && mv tmpfile /scripts/ropc.jmx +cat /scripts/tests/resource_owner_password_credentials.jmx | replace_all > tmpfile && mv tmpfile /scripts/resource_owner_password_credentials.jmx if [[ "$RUN_AUTHZ_TEST" = "true" ]] then @@ -61,7 +69,7 @@ if [[ "$RUN_ROPC_TEST" = "true" ]] then echo "Resource owner password credential grant flow is activated." # Add -o modules.console.disable=true to disable TUI - bzt /scripts/ropc.jmx + bzt /scripts/resource_owner_password_credentials.jmx exit 0 fi diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx index 415f78e8d12..5a6b96fecc8 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx @@ -78,7 +78,7 @@ false -1 - THREADCOUNT + THREAD_COUNT 10 1479823133000 1479823133000 diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx similarity index 67% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx rename to demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx index e5cea9f2c35..8653b7f5bba 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code.jmx +++ b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx @@ -1,7 +1,7 @@ - + - + false true @@ -27,19 +27,14 @@ topsecret = - - redirect_uri - https://FQDN/identity/authcode.htm - = - client_id - AUTHZ_CLIENT_ID + ROPC_CLIENT_ID = client_secret - AUTHZ_CLIENT_SECRET + ROPC_CLIENT_SECRET = @@ -47,11 +42,6 @@ to_override_in_jsr223 = - - location_regexp - Location: https:\/\/FQDN_PART1\.FQDN_PART2\.FQDN_PART3(.*) - = - @@ -63,22 +53,22 @@ ${host} + 60000 + 60000 https - 6 HttpClient4 - 60000 - 60000 + 6 continue false - -1 + 1 - 200 + THREAD_COUNT 10 1479823133000 1479823133000 @@ -108,230 +98,59 @@ false - - + + - - true - ${scope} - = - true - scope - - + false - code + password = true - response_type + grant_type - + false - nonce - = - true - nonce - - - true - ${redirect_uri} + ${username} = true - redirect_uri + username - - true - ${client_id} + + false + ${password} = true - client_id + password - https - - /oxauth/restv1/authorize - GET - true - false - false - false - - HttpClient4 - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - usernameField - <input id="loginForm:username" name="(.+?)" type="text" - $1$ - UNKNOWN - 1 - - - - false - userpasswordField - <input id="loginForm:password" name="(.+?)" type="password" - $1$ - UNKNOWN - 1 - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - true - true - false - - - - - - - - false - loginForm - loginForm - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - - = - true - - - true - javax.faces.ViewState - stateless - = - true - - - false - {"description":"Chrome 67.0.3396.99 on Windows Server 2008 R2 / 7 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36","version":"67.0","os":{"architecture":64,"family":"Windows Server 2008 R2 / 7","version":"7"}} - = - true - loginForm:platform - - - - - 443 - https - UTF-8 - /oxauth/login.htm + + + /jans-auth/restv1/token POST - false + true false false false - HttpClient4 - - - Detected the start of a redirect chain + false + - + + Authorization + ${client_header} + + Content-Type application/x-www-form-urlencoded - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - @@ -369,177 +188,6 @@ log.info("username: " + vars.get("username") + ", passw - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - false - true - true - false - - - - - true - 2 - - - - - - - - 443 - - - ${redirect_to} - GET - false - false - false - false - - - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - true - - - String code = ""; -String redirectTo = vars.get("redirect_to"); -if (redirectTo.contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code + ", redirect_to:" + redirectTo); - - java - - - - true - true - true - true - - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - /oxauth/restv1/token - POST - true - false - false - false - - HttpClient4 - - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - true @@ -547,6 +195,7 @@ log.info("login post processor, code : " + code + ", redirect_to: String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); +OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); vars.put("client_header", clientHeader); java @@ -622,18 +271,19 @@ vars.put("client_header", clientHeader); + + - /oxauth/restv1/userinfo + /jans-auth/restv1/userinfo POST true false false false - HttpClient4 - - + false + @@ -698,7 +348,7 @@ log.info("session_state_counter : " + session_state_counter); for (int i = 0; i < collectionProperty.size(); i++) { JMeterProperty p = collectionProperty.get(i); - + if ("session_state".equals(p.getName())) { //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); @@ -716,12 +366,12 @@ for (int i = 0; i < collectionProperty.size(); i++) { + 60000 + 60000 6 - 60000 - 60000 @@ -936,6 +586,8 @@ for (int i = 0; i < collectionProperty.size(); i++) { + + @@ -944,9 +596,8 @@ for (int i = 0; i < collectionProperty.size(); i++) { false true false + false - - @@ -966,9 +617,9 @@ for (Map.Entry entry : props.entrySet()) { String counter = key.substring("oic.session_state.".length()); log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - + Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); + manager.add(cookie); Object idToken = props.getProperty("oic.id_token." + counter); log.info("PRE end session, id_token : " + idToken); @@ -1167,6 +818,7 @@ for (Map.Entry entry : props.entrySet()) { false + true @@ -1227,6 +879,8 @@ vars.put("client_header", clientHeader); + + /oxauth/restv1/token @@ -1235,9 +889,8 @@ vars.put("client_header", clientHeader); false true false + false - - diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx b/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx deleted file mode 100644 index 0cd37d42f98..00000000000 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/ropc.jmx +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - false - true - - - - host - FQDN - = - - - username - user350101 - = - - - password - topsecret - = - - - client_id - ROPC_CLIENT_ID - = - - - client_secret - ROPC_CLIENT_SECRET - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - https - - - 6 - HttpClient4 - 60000 - 60000 - - - - continue - - false - -1 - - 1 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - true - false - - - - - - - true - grant_type - password - = - true - - - true - username - ${username} - = - true - - - true - password - ${password} - = - true - - - true - ${client_id} - = - true - client_id - - - true - ${client_secret} - = - true - client_secret - - - - - 443 - https - UTF-8 - /oxauth/restv1/token - POST - false - false - true - false - - HttpClient4 - - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - Authorization_disabled - Basic ${client_header} - - - - - - java - - - true - double weight = 0.7d; - -// 10% -int min = FIRST_BATCH_MIN; -int max = FIRST_BATCH_MAX; - -// 90% -int maxX = SECOND_BATCH_MIN; -int maxY = SECOND_BATCH_MAX; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = maxX; - max = maxY; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "user" + userNumber; -String password = "topsecret" + userNumber; - -//log.info("username: " + username); - -vars.put("username", username); -vars.put("password", password); - -log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); - - - - - java - - - true - import org.apache.commons.codec.binary.Base64; - -String clientCredentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientCredentialsEncoded = Base64.encodeBase64String(clientCredentials.getBytes()); - -vars.put("client_header", clientCredentialsEncoded); - -log.info("client_header: " + vars.get("client_header")); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - true - true - false - - - - - - - - - - - - - 6 - 60000 - 60000 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml similarity index 61% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml rename to demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml index 74de9386c40..82deeb0e972 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_test.yaml +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml @@ -1,18 +1,15 @@ apiVersion: v1 data: - AUTHZ_CLIENT_ID: 1001.21beb9f2-e8de-4b10-949f-5cf31a28f95b # Saved from steps above - AUTHZ_CLIENT_SECRET: FWLmNKmVcQZt # Saved from steps above + AUTHZ_CLIENT_ID: "aa4c8edf-1d68-462b-ac49-178c7b1db8fd" + AUTHZ_CLIENT_SECRET: "9c077c8a-dc84-4baa-abde-edc1a343e3e3" # First batch is the users from min - max that login 10% every time - FIRST_BATCH_MAX: "5000000" + FIRST_BATCH_MAX: "1000" FIRST_BATCH_MIN: "0" # Second batch is the users from min - max that login 90% every time - SECOND_BATCH_MAX: "50000000" - SECOND_BATCH_MIN: "5000001" + SECOND_BATCH_MAX: "5000" + SECOND_BATCH_MIN: "1002" FQDN: demoexample.jans.io - ROPC_CLIENT_ID: c1b9628e-84f5-43e6-bf00-b341543703d9 # Saved from steps above - ROPC_CLIENT_SECRET: test_ro_client_password # Saved from steps above RUN_AUTHZ_TEST: "true" # or "false" - RUN_ROPC_TEST: "true" # or "false" kind: ConfigMap metadata: labels: @@ -35,6 +32,10 @@ spec: labels: app: load-testing spec: + #hostAliases: + #- ip: 35.159.30.85 + # hostnames: + # - demoexample.jans.io containers: - envFrom: - configMapRef: @@ -44,8 +45,8 @@ spec: name: load-testing resources: requests: - memory: "4000Mi" - cpu: "4000m" + memory: "2000Mi" + cpu: "2000m" limits: - memory: "4000Mi" - cpu: "4000m" \ No newline at end of file + memory: "2000Mi" + cpu: "2000m" \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml similarity index 68% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml rename to demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml index 2082e94e298..d7097e38cbf 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_couchbase_job.yaml +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml @@ -3,37 +3,34 @@ kind: ConfigMap metadata: labels: app: load-users - name: load-users-cm + name: load-users-cb-cm data: COUCHBASE_PW: Test1234# COUCHBASE_URL: cb.cbns.svc.cluster.local LOAD_USERS_TO_COUCHBASE: "true" - LOAD_USERS_TO_LDAP: "false" - NUMBERS_OF_USERS_TO_LOAD: "500000000" - LDAP_URL: "opendj:1636" - LDAP_PW: Test1234# - LDAP_DN: "cn=directory manager" + USER_NUMBER_STARTING_POINT: "0" + USER_NUMBER_ENDING_POINT: "100000" --- apiVersion: batch/v1 kind: Job metadata: labels: app: load-users - name: load-users + name: load-users-cb spec: template: metadata: labels: app: load-users spec: - hostAliases: - - ip: NGINX_IP - hostnames: - - FQDN + #hostAliases: + # - ip: NGINX_IP + # hostnames: + # - FQDN containers: - envFrom: - configMapRef: - name: load-users-cm + name: load-users-cb-cm image: janssenproject/demo_loadtesting:1.0.0_dev name: load-users resources: diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml new file mode 100644 index 00000000000..df93f7d2099 --- /dev/null +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: load-users + name: load-users-ldap-cm +data: + LDAP_URL: opendj:1636 + LDAP_PW: Test1234# + LOAD_USERS_TO_LDAP: "true" + USER_NUMBER_STARTING_POINT: "0" + USER_NUMBER_ENDING_POINT: "100000" +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: load-users + name: load-users-ldap +spec: + template: + metadata: + labels: + app: load-users + spec: + #hostAliases: + # - ip: NGINX_IP + # hostnames: + # - FQDN + containers: + - envFrom: + - configMapRef: + name: load-users-ldap-cm + image: janssenproject/demo_loadtesting:1.0.0_dev + name: load-users + resources: + limits: + cpu: 10000m + memory: 5000Mi + requests: + cpu: 10000m + memory: 5000Mi + restartPolicy: Never diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml similarity index 74% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml rename to demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml index 81ea29402e2..108eb030634 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_rdbms_job.yaml +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml @@ -3,7 +3,7 @@ kind: ConfigMap metadata: labels: app: load-users - name: load-users-cm + name: load-users-mysql-cm data: LOAD_USERS_TO_RDBMS: "true" RDBMS_TYPE: 'mysql' @@ -11,7 +11,8 @@ data: RDBMS_USER: "root" RDBMS_PASSWORD: Test1234# RDBMS_HOST: "my-release-mysql.mysql.svc.cluster.local" - NUMBERS_OF_USERS_TO_LOAD: "500000000" + USER_NUMBER_STARTING_POINT: "0" + USER_NUMBER_ENDING_POINT: "100000" --- apiVersion: batch/v1 kind: Job @@ -25,16 +26,16 @@ spec: labels: app: load-users spec: - hostAliases: - - ip: NGINX_IP - hostnames: - - FQDN + #hostAliases: + # - ip: NGINX_IP + # hostnames: + # - FQDN containers: - envFrom: - configMapRef: - name: load-users-cm + name: load-users-mysql-cm image: janssenproject/demo_loadtesting:1.0.0_dev - name: load-users + name: load-users-mysql resources: limits: cpu: 10000m diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml similarity index 66% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml rename to demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml index b9c44a0e0bd..b77a2a4590a 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load_users_spanner_job.yaml +++ b/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml @@ -3,26 +3,22 @@ kind: ConfigMap metadata: labels: app: load-users - name: load-users-cm + name: load-users-spanner-cm data: GOOGLE_APPLICATION_CREDENTIALS: '/etc/certs/google_service_account.json' GOOGLE_PROJECT_ID: cb.cbns.svc.cluster.local GOOGLE_SPANNER_INSTANCE_ID: "cn-test" GOOGLE_SPANNER_DATABASE_ID: "test" LOAD_USERS_TO_SPANNER: "true" - LOAD_USERS_TO_LDAP: "false" - LOAD_USERS_TO_COUCHBASE: "false" - NUMBERS_OF_USERS_TO_LOAD: "500000000" - LDAP_URL: "opendj:1636" - LDAP_PW: Test1234# - LDAP_DN: "cn=directory manager" + USER_NUMBER_STARTING_POINT: "0" + USER_NUMBER_ENDING_POINT: "100000" --- apiVersion: batch/v1 kind: Job metadata: labels: app: load-users - name: load-users + name: load-users-spanner spec: backoffLimit: 1 template: @@ -30,10 +26,10 @@ spec: labels: app: load-users spec: - hostAliases: - - ip: NGINX_IP - hostnames: - - FQDN + #hostAliases: + # - ip: NGINX_IP + # hostnames: + # - FQDN volumes: - name: google-sa secret: @@ -41,13 +37,13 @@ spec: containers: - envFrom: - configMapRef: - name: load-users-cm + name: load-users-spanner-cm image: janssenproject/demo_loadtesting:1.0.0_dev volumeMounts: - - mountPath: /etc/jans/conf/google-credentials.json + - mountPath: /etc/certs/google_service_account.json name: google-sa - subPath: google-credentials.json - name: load-users + subPath: google_service_account.json + name: load-users-spanner resources: limits: cpu: 30000m diff --git a/docs/admin/planning/benchmarking.md b/docs/admin/planning/benchmarking.md index 237b7288e55..585cb8a192b 100644 --- a/docs/admin/planning/benchmarking.md +++ b/docs/admin/planning/benchmarking.md @@ -61,39 +61,66 @@ justified. 1. Response Types: ['code', 'id_token] 1. Grant Types: ['authorization_code', `implicit`, 'refresh_token'] 1. Redirect Uri: valid redirect uri which is resolvable by machine which runs this load test -1. Create users by pattern: - 1. username: `test_user1`, `test_user2`, ... `test_userN` - 1. secret: `test_user_password` - Following script can be used [add_sequenced_jans_user_rdbm.py](https://github.com/JanssenProject/jans/tree/main/demos/benchmarking/scripts/add_users_rdbm.py) - -**User Selection Logic** - -`JSR223 PreProcessor : identify user credentials` has following logic for user selection -```java -double weight = 0.7d; +```bash +cat << EOF > auth_code_client.json +{ + "dn": null, + "inum": null, + "displayName": "Auth Code Flow Load Test Client", + "redirectUris": [ + "https://FQDN" + ], + "responseTypes": [ + "id_token", + "code" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token" + ], + "tokenEndpointAuthMethod": "client_secret_basic", + "scopes": [ + "openid", + "profile", + "email", + "user_name" + ], + "trustedClient": true, + "includeClaimsInIdToken": false, + "accessTokenAsJwt": false, + "disabled": false, + "deletable": false, + "description": "Auth Code Flow Load Testing Client" +} +EOF +``` -int min = 1; -int max = 1000; +Download or build [config-cli-tui](../config-guide/tui.md) and run: -int minX = 1001; -int maxX = 100000; +```bash +# add -noverify if your fqdn is not registered +./config-cli-tui.pyz --host --client-id --client-secret --no-tui --operation-id=post-oauth-openid-client --data=auth_code_client.json +``` -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} +1. Create users by pattern: +Set the following [env vars](../../../demos/benchmarking/docker-loadtesting-jmeter/README.md#loading-users) -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "test_user" + userNumber; +| ENV | Example | +|------------------------------|--------------------| +| `LOAD_USERS_TO_RDBMS` | `true` | +| `RDBMS_TYPE` | `mysql` or `pgsql` | +| `RDBMS_DB` | `jans` | +| `RDBMS_USER` | `root` | +| `RDBMS_PASSWORD` | `Secret` | +| `RDBMS_HOST` | `mysql.jans.io` | +| `USER_NUMBER_STARTING_POINT` | 0 | +| `USER_NUMBER_ENDING_POINT` | 10000 | -//log.info("username: " + username); -vars.put("username", username); -``` +Run the following script [add_sequenced_jans_user_rdbm.py](../../../demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py) -Please change it if needed. **Threads&RampUp** From 92347dabc2723d7b91587dedabe99b7d655d74dd Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Thu, 29 Dec 2022 15:13:13 +0000 Subject: [PATCH 09/11] fix: add benchmark doc and yaml --- .github/workflows/docker_build_image.yml | 27 +- charts/janssen/values.yaml | 4 +- .../.dockerignore | 0 .../.gitattributes | 0 .../.gitignore | 0 .../.hadolint.yaml | 0 .../Dockerfile | 31 +- .../LICENSE | 0 .../Makefile | 4 +- .../README.md | 24 +- .../requirements.txt | 14 + .../scripts/add_users_couchbase.py | 0 .../scripts/add_users_ldap.py | 0 .../scripts/add_users_rdbm.py | 0 .../scripts/add_users_spanner.py | 0 .../scripts/entrypoint.sh | 7 +- .../scripts/tests/authorization_code_flow.jmx | 0 .../scripts/tests/implicit_flow.jmx} | 30 +- .../resource_owner_password_credentials.jmx | 0 .../version.txt | 0 .../yaml/load-test/load_test_auth_code.yaml | 18 +- .../load-users/load_users_couchbase_job.yaml | 2 +- .../yaml/load-users/load_users_ldap_job.yaml | 2 +- .../yaml/load-users/load_users_rdbms_job.yaml | 2 +- .../load-users/load_users_spanner_job.yaml | 2 +- .../requirements.txt | 4 - .../jmeter/test/Authorization Code Flow.jmx | 925 ------------ .../test/Authorization Code Flow_amazon.jmx | 1070 ------------- ...on Code Flow_amazon_client_credentials.jmx | 625 -------- .../test/Authorization Code Flow_ce-dev5.jmx | 1317 ----------------- .../test/Authorization Code Flow_jans.jmx | 1315 ---------------- .../test/Authorization Code Flow_xeon.jmx | 1242 ---------------- ...tion Code Flow_xeon_client_credentials.jmx | 625 -------- .../test/Implicit_Flow_benchmark_gluu_org.jmx | 1018 ------------- .../ResourceOwnerPasswordCredentials_jans.jmx | 966 ------------ .../ResourceOwnerPasswordCredentials_jans.jmx | 966 ------------ ...Test user authorization - testing data.csv | 3 - .../oxServer - Test user authorization.jmx | 712 --------- docs/admin/planning/benchmarking.md | 4 +- docs/admin/recipes/benchmark.md | 279 ++++ mkdocs.yml | 1 + 41 files changed, 373 insertions(+), 10866 deletions(-) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/.dockerignore (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/.gitattributes (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/.gitignore (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/.hadolint.yaml (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/Dockerfile (73%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/LICENSE (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/Makefile (90%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/README.md (78%) create mode 100644 demos/benchmarking/docker-jans-loadtesting-jmeter/requirements.txt rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/add_users_couchbase.py (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/add_users_ldap.py (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/add_users_rdbm.py (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/add_users_spanner.py (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/entrypoint.sh (93%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/tests/authorization_code_flow.jmx (100%) rename demos/{load-testing/jmeter/test/Implicit_Flow_c7_horizontal_scale.jmx => benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/implicit_flow.jmx} (98%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/scripts/tests/resource_owner_password_credentials.jmx (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/version.txt (100%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/yaml/load-test/load_test_auth_code.yaml (67%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/yaml/load-users/load_users_couchbase_job.yaml (95%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/yaml/load-users/load_users_ldap_job.yaml (95%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/yaml/load-users/load_users_rdbms_job.yaml (96%) rename demos/benchmarking/{docker-loadtesting-jmeter => docker-jans-loadtesting-jmeter}/yaml/load-users/load_users_spanner_job.yaml (97%) delete mode 100644 demos/benchmarking/docker-loadtesting-jmeter/requirements.txt delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_amazon.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_amazon_client_credentials.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_ce-dev5.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_jans.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_xeon.jmx delete mode 100644 demos/load-testing/jmeter/test/Authorization Code Flow_xeon_client_credentials.jmx delete mode 100644 demos/load-testing/jmeter/test/Implicit_Flow_benchmark_gluu_org.jmx delete mode 100644 demos/load-testing/jmeter/test/ResourceOwnerPasswordCredentials_jans.jmx delete mode 100644 demos/load-testing/jmeter/test/authorization/ResourceOwnerPasswordCredentials_jans.jmx delete mode 100644 demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization - testing data.csv delete mode 100644 demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization.jmx create mode 100644 docs/admin/recipes/benchmark.md diff --git a/.github/workflows/docker_build_image.yml b/.github/workflows/docker_build_image.yml index b6f741d0911..608a5948fec 100644 --- a/.github/workflows/docker_build_image.yml +++ b/.github/workflows/docker_build_image.yml @@ -23,9 +23,9 @@ on: workflow_dispatch: inputs: services: - description: 'One or set of the docker images. Format as following: "docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith"' + description: 'One or set of the docker images. Format as following: "docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith docker-jans-loadtesting-jmeter"' required: true - default: 'docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith' + default: 'docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith docker-jans-loadtesting-jmeter' cn_version: description: 'The war version to build the image off' required: false @@ -44,7 +44,7 @@ jobs: strategy: max-parallel: 8 matrix: - docker-images: ["auth-server", "certmanager", "config-api", "configurator", "fido2", "persistence-loader", "scim", "monolith"] + docker-images: ["auth-server", "certmanager", "config-api", "configurator", "fido2", "persistence-loader", "scim", "monolith", "loadtesting-jmeter"] steps: - name: Checkout uses: actions/checkout@v3 @@ -58,7 +58,7 @@ jobs: DEFAULT_ALL=${{ github.event.inputs.services }} if [ -z "$DEFAULT_ALL" ] then - DEFAULT_ALL="docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith" + DEFAULT_ALL="docker-jans-auth-server docker-jans-certmanager docker-jans-config-api docker-jans-configurator docker-jans-fido2 docker-jans-persistence-loader docker-jans-scim docker-jans-monolith docker-jans-loadtesting-jmeter" else echo "$DEFAULT_ALL" fi @@ -66,7 +66,7 @@ jobs: pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") DIRECTORIES_CHANGED=$(gh pr view $pull_number --json files --jq '.files.[].path' | cut -d/ -f1 | sort -u | grep "docker-jans" || echo "$DEFAULT_ALL") if [[ "$DIRECTORIES_CHANGED" =~ "${{ matrix.docker-images }}" ]]; then - echo "A change in this images directory has occured" + echo "A change in this images directory has occurred" echo ::set-output name=build::${BUILD} fi @@ -84,7 +84,11 @@ jobs: if: steps.build_docker_image.outputs.build || github.event_name == 'tags' id: prep run: | - MAIN_VERSION=$(python3 -c "from dockerfile_parse import DockerfileParser ; dfparser = DockerfileParser('./docker-jans-${{ matrix.docker-images }}') ; print(dfparser.labels['version'])") + DOCKER_FILE_LOCATION=./docker-jans-${{ matrix.docker-images }} + if [[ "loadtesting-jmeter" =~ "${{ matrix.docker-images }}" ]]; then + DOCKER_FILE_LOCATION=./demos/benchmarking/docker-jans-loadtesting-jmeter + fi + MAIN_VERSION=$(python3 -c "from dockerfile_parse import DockerfileParser ; dfparser = DockerfileParser('$DOCKER_FILE_LOCATION') ; print(dfparser.labels['version'])") DOCKER_IMAGE=janssenproject/${{ matrix.docker-images }} VERSION=${MAIN_VERSION}_dev BUILD=true @@ -118,16 +122,17 @@ jobs: fi echo ::set-output name=tags::${TAGS} echo ::set-output name=build::${BUILD} + echo ::set-output name=dockerfilelocation::${DOCKER_FILE_LOCATION} # UPDATE BUILD DATES INSIDE THE DOCKERFILE BEFORE BUILDING THE DEV IMAGES TRIGGERED BY JENKINS - name: Setup Python 3.7 - if: github.event_name == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' uses: actions/setup-python@v4 with: python-version: 3.7 - name: Install Python dependencies - if: github.event_name == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' run: | sudo apt-get update sudo python3 -m pip install --upgrade pip @@ -137,7 +142,7 @@ jobs: sudo apt-get install jq - name: Update Build date in Dockerfile - if: github.event_name == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' id: update_build_date_in_dockerfile run: | sudo python3 ./automation/auto_update_build_date.py @@ -177,8 +182,8 @@ jobs: uses: docker/build-push-action@v3 with: builder: ${{ steps.buildx.outputs.name }} - context: ./docker-jans-${{ matrix.docker-images }} - file: ./docker-jans-${{ matrix.docker-images }}/Dockerfile + context: ${{ steps.prep.outputs.dockerfilelocation }} + file: ${{ steps.prep.outputs.dockerfilelocation }}/Dockerfile #target: prod # add to platforms comma seperated linux/ppc64leL Issue: py3-grpcio # add to platforms comma seperated linux/386 : Issue: openjdk11-jre-headless alpine package not diff --git a/charts/janssen/values.yaml b/charts/janssen/values.yaml index c97d2913ded..3e47fe8379a 100644 --- a/charts/janssen/values.yaml +++ b/charts/janssen/values.yaml @@ -367,12 +367,12 @@ config-api: # -- CPU limit. cpu: 1000m # -- Memory limit. - memory: 400Mi + memory: 1000Mi requests: # -- CPU request. cpu: 1000m # -- Memory request. - memory: 400Mi + memory: 1000Mi # -- Configure the liveness healthcheck for the auth server if needed. livenessProbe: # -- http liveness probe endpoint diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.dockerignore b/demos/benchmarking/docker-jans-loadtesting-jmeter/.dockerignore similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/.dockerignore rename to demos/benchmarking/docker-jans-loadtesting-jmeter/.dockerignore diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.gitattributes b/demos/benchmarking/docker-jans-loadtesting-jmeter/.gitattributes similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/.gitattributes rename to demos/benchmarking/docker-jans-loadtesting-jmeter/.gitattributes diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.gitignore b/demos/benchmarking/docker-jans-loadtesting-jmeter/.gitignore similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/.gitignore rename to demos/benchmarking/docker-jans-loadtesting-jmeter/.gitignore diff --git a/demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/.hadolint.yaml similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/.hadolint.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/.hadolint.yaml diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile b/demos/benchmarking/docker-jans-loadtesting-jmeter/Dockerfile similarity index 73% rename from demos/benchmarking/docker-loadtesting-jmeter/Dockerfile rename to demos/benchmarking/docker-jans-loadtesting-jmeter/Dockerfile index 72d4e81a024..dd407d94205 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/Dockerfile +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get clean \ && apt-get clean RUN apt-get update \ - && apt-get install openjdk-8-jre-headless wget git bash python3-dev lsb-core python3-setuptools cmake build-essential apt-utils python3-pip -y + && apt-get install openjdk-8-jre-headless wget git bash python3 python3-dev lsb-core python3-setuptools cmake build-essential apt-utils python3-pip -y # =============== # Environmental Variables @@ -48,23 +48,16 @@ ENV FQDN="https://demoexample.jans.io" \ RDBMS_PASSWORD="" \ RDBMS_HOST="localhost" -# =============== -# Install Couchbase Client -# =============== -RUN apt-get update \ - && python3 -m pip install couchbase -# ======================= -# Install Spanner package -# ======================= +# ====== +# Python +# ====== -RUN python3 -m pip install google-cloud-spanner - -# =============== -# Packages -# =============== -RUN pip install joblib ldap3 pygtail psycopg2 PyMySQL +COPY requirements.txt /scripts/requirements.txt +RUN pip install --no-cache-dir -U pip wheel \ + && pip3 install --no-cache-dir --default-timeout=300 -r /scripts/requirements.txt \ + && pip3 uninstall -y pip wheel COPY scripts /scripts @@ -73,4 +66,12 @@ RUN mkdir -p /root/.bzt/jmeter-taurus \ && tar zxvf /scripts/apache-jmeter-5.5.tgz -C /root/.bzt/jmeter-taurus \ && mv /root/.bzt/jmeter-taurus/apache-jmeter-5.5 /root/.bzt/jmeter-taurus/5.5 +LABEL name="janssenproject/demo_loadtesting" \ + maintainer="Janssen Project " \ + vendor="Janssen Project" \ + version="1.0.6" \ + release="dev" \ + summary="Janssen Jmeter tests" \ + description="Janssen Jmeter and user loader image" + ENTRYPOINT ["bash", "/scripts/entrypoint.sh"] diff --git a/demos/benchmarking/docker-loadtesting-jmeter/LICENSE b/demos/benchmarking/docker-jans-loadtesting-jmeter/LICENSE similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/LICENSE rename to demos/benchmarking/docker-jans-loadtesting-jmeter/LICENSE diff --git a/demos/benchmarking/docker-loadtesting-jmeter/Makefile b/demos/benchmarking/docker-jans-loadtesting-jmeter/Makefile similarity index 90% rename from demos/benchmarking/docker-loadtesting-jmeter/Makefile rename to demos/benchmarking/docker-jans-loadtesting-jmeter/Makefile index 9d58bdb8bf7..9c92e3425b8 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/Makefile +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/Makefile @@ -1,5 +1,5 @@ -CN_VERSION?=1.0.0 -IMAGE_NAME=demo_loadtesting +CN_VERSION?=1.0.6 +IMAGE_NAME=janssenproject/demo_loadtesting DEV_VERSION?=$(shell echo ${CN_VERSION} | cut -d '-' -f 1)_dev .PHONY: test clean all build-dev trivy-scan grype-scan diff --git a/demos/benchmarking/docker-loadtesting-jmeter/README.md b/demos/benchmarking/docker-jans-loadtesting-jmeter/README.md similarity index 78% rename from demos/benchmarking/docker-loadtesting-jmeter/README.md rename to demos/benchmarking/docker-jans-loadtesting-jmeter/README.md index cc51db76de4..737370bdd09 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/README.md +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/README.md @@ -41,17 +41,19 @@ Installation depends on the set of environment variables shown below. These envi ### Running tests -| ENV | Description | Default | -|----------------------------------|-----------------------------------------------------------------|--------------------------------------------------| -| `FQDN` | The hostname janssen is using. | `https://demoexample.jans.io` | -| `AUTHZ_CLIENT_ID` | Authorization code client id | `` | -| `AUTHZ_CLIENT_SECRET` | Authorization code client secret | `` | -| `ROPC_CLIENT_ID` | Resource grant client id | `` | -| `ROPC_CLIENT_SECRET` | Resource grant client secret | `` | -| `RUN_AUTHZ_TEST` | Run the Authorization code test | `false` | -| `RUN_ROPC_TEST` | Run the ROPC test | `false` | -| `TEST_USERS_PREFIX_STRING` | The user prefix string attached to the test users loaded | `test_user` | -| `THREAD_COUNT` | Thread count in jmeter tests | `200` | +| ENV | Description | Default | +|------------------------------|----------------------------------------------------------|-------------------------------| +| `FQDN` | The hostname janssen is using. | `https://demoexample.jans.io` | +| `AUTHZ_CLIENT_ID` | Authorization code client id | `` | +| `AUTHZ_CLIENT_SECRET` | Authorization code client secret | `` | +| `ROPC_CLIENT_ID` | Resource grant client id | `` | +| `ROPC_CLIENT_SECRET` | Resource grant client secret | `` | +| `RUN_AUTHZ_TEST` | Run the Authorization code test | `false` | +| `RUN_ROPC_TEST` | Run the ROPC test | `false` | +| `TEST_USERS_PREFIX_STRING` | The user prefix string attached to the test users loaded | `test_user` | +| `THREAD_COUNT` | Thread count in jmeter tests | `200` | +| `USER_NUMBER_STARTING_POINT` | The user number to start from . | `0` | +| `USER_NUMBER_ENDING_POINT` | The user number to end at. | `50000000` | ## How to run diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/requirements.txt b/demos/benchmarking/docker-jans-loadtesting-jmeter/requirements.txt new file mode 100644 index 00000000000..c2057ef9a73 --- /dev/null +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/requirements.txt @@ -0,0 +1,14 @@ +# pinned to py3-grpcio version to avoid failure on native extension build +joblib +ldap3 +pygtail +psycopg2-binary +PyMySQL +# ======================= +# Install Spanner package +# ======================= +google-cloud-spanner +# =============== +# Install Couchbase Client +# =============== +couchbase diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_couchbase.py similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_couchbase.py rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_couchbase.py diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_ldap.py similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_ldap.py rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_ldap.py diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_rdbm.py similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_rdbm.py diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_spanner.py similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_spanner.py rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_spanner.py diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/entrypoint.sh similarity index 93% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/entrypoint.sh index e39a4fe4bd5..5d40e828ff7 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/scripts/entrypoint.sh +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/entrypoint.sh @@ -30,11 +30,10 @@ fi replace_all() { users_range=$(((USER_NUMBER_ENDING_POINT-USER_NUMBER_STARTING_POINT))) - FIRST_BATCH_MIN=USER_NUMBER_STARTING_POINT - SECOND_BATCH_MAX=USER_NUMBER_ENDING_POINT - FIRST_BATCH_MAX=$((((USER_NUMBER_STARTING_POINT*10)/100))) + FIRST_BATCH_MIN="$USER_NUMBER_STARTING_POINT" + SECOND_BATCH_MAX="$USER_NUMBER_ENDING_POINT" + FIRST_BATCH_MAX=$((((users_range*10)/100))) SECOND_BATCH_MIN=$((FIRST_BATCH_MAX+1)) - SECOND_BATCH_MAX=$(((((USER_NUMBER_STARTING_POINT*10)/100)+1))) IFS='.' read -ra FQDN_PARTS <<< "$FQDN" sed "s#AUTHZ_CLIENT_ID#$AUTHZ_CLIENT_ID#g" \ diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/authorization_code_flow.jmx diff --git a/demos/load-testing/jmeter/test/Implicit_Flow_c7_horizontal_scale.jmx b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/implicit_flow.jmx similarity index 98% rename from demos/load-testing/jmeter/test/Implicit_Flow_c7_horizontal_scale.jmx rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/implicit_flow.jmx index 0c7b75f668d..a5fe2b82e7c 100644 --- a/demos/load-testing/jmeter/test/Implicit_Flow_c7_horizontal_scale.jmx +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/implicit_flow.jmx @@ -9,7 +9,7 @@ host - c7.gluu.org + FQDN = @@ -34,12 +34,12 @@ client_id - @!BEC5.3835.F781.311D!0001!7E45.43DF!0008!B20B.4D91 + AUTHZ_CLIENT_ID = client_secret - 4Dyh1YpQTJmT + AUTHZ_CLIENT_SECRET = @@ -83,8 +83,8 @@ false 1 - 1 - 1 + THREAD_COUNT + 10 1479823133000 1479823133000 false @@ -303,7 +303,7 @@ Referer - https://${host}/oxauth/login + https://${host}/jans-auth/login Accept-Encoding @@ -319,11 +319,13 @@ 5747dfc9-3b64-496f-947f-e9ce907c06cd double weight = 0.7d; -int min = 1; -int max = 1000; +// 10% +int min = FIRST_BATCH_MIN; +int max = FIRST_BATCH_MAX; -int minX = 1001; -int maxX = 100000; +// 90% +int minX = SECOND_BATCH_MIN; +int maxX = SECOND_BATCH_MAX; float chance = new Random().nextFloat(); if (chance <= weight) { @@ -332,12 +334,8 @@ if (chance <= weight) { } int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "user" + userNumber; -String username = "admin"; - -log.info("username: " + "admin"); - -vars.put("username", "admin"); +String username = "TEST_USERS_PREFIX_STRING" + userNumber; +String password = "topsecret" + userNumber; diff --git a/demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx b/demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx rename to demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/tests/resource_owner_password_credentials.jmx diff --git a/demos/benchmarking/docker-loadtesting-jmeter/version.txt b/demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt similarity index 100% rename from demos/benchmarking/docker-loadtesting-jmeter/version.txt rename to demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml similarity index 67% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml index 82deeb0e972..59a540c5cb8 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml @@ -2,12 +2,8 @@ apiVersion: v1 data: AUTHZ_CLIENT_ID: "aa4c8edf-1d68-462b-ac49-178c7b1db8fd" AUTHZ_CLIENT_SECRET: "9c077c8a-dc84-4baa-abde-edc1a343e3e3" - # First batch is the users from min - max that login 10% every time - FIRST_BATCH_MAX: "1000" - FIRST_BATCH_MIN: "0" - # Second batch is the users from min - max that login 90% every time - SECOND_BATCH_MAX: "5000" - SECOND_BATCH_MIN: "1002" + USER_NUMBER_STARTING_POINT: 0 + USER_NUMBER_ENDING_POINT: 10000000 FQDN: demoexample.jans.io RUN_AUTHZ_TEST: "true" # or "false" kind: ConfigMap @@ -40,13 +36,13 @@ spec: - envFrom: - configMapRef: name: load-testing-cm - image: janssenproject/demo_loadtesting:1.0.0_dev + image: janssenproject/demo_loadtesting:1.0.6_dev imagePullPolicy: Always name: load-testing resources: requests: - memory: "2000Mi" - cpu: "2000m" + memory: "8000Mi" + cpu: "1300m" limits: - memory: "2000Mi" - cpu: "2000m" \ No newline at end of file + memory: "8000Mi" + cpu: "1300m" \ No newline at end of file diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml similarity index 95% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml index d7097e38cbf..504e7577699 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml @@ -9,7 +9,7 @@ data: COUCHBASE_URL: cb.cbns.svc.cluster.local LOAD_USERS_TO_COUCHBASE: "true" USER_NUMBER_STARTING_POINT: "0" - USER_NUMBER_ENDING_POINT: "100000" + USER_NUMBER_ENDING_POINT: "10000000" --- apiVersion: batch/v1 kind: Job diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml similarity index 95% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml index df93f7d2099..6e07e41f5da 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml @@ -9,7 +9,7 @@ data: LDAP_PW: Test1234# LOAD_USERS_TO_LDAP: "true" USER_NUMBER_STARTING_POINT: "0" - USER_NUMBER_ENDING_POINT: "100000" + USER_NUMBER_ENDING_POINT: "10000000" --- apiVersion: batch/v1 kind: Job diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml similarity index 96% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml index 108eb030634..aab8bdc0a99 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml @@ -12,7 +12,7 @@ data: RDBMS_PASSWORD: Test1234# RDBMS_HOST: "my-release-mysql.mysql.svc.cluster.local" USER_NUMBER_STARTING_POINT: "0" - USER_NUMBER_ENDING_POINT: "100000" + USER_NUMBER_ENDING_POINT: "10000000" --- apiVersion: batch/v1 kind: Job diff --git a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml similarity index 97% rename from demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml rename to demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml index b77a2a4590a..6d308cca245 100644 --- a/demos/benchmarking/docker-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml @@ -11,7 +11,7 @@ data: GOOGLE_SPANNER_DATABASE_ID: "test" LOAD_USERS_TO_SPANNER: "true" USER_NUMBER_STARTING_POINT: "0" - USER_NUMBER_ENDING_POINT: "100000" + USER_NUMBER_ENDING_POINT: "10000000" --- apiVersion: batch/v1 kind: Job diff --git a/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt b/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt deleted file mode 100644 index fab1ffb179a..00000000000 --- a/demos/benchmarking/docker-loadtesting-jmeter/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -# pinned to py3-grpcio version to avoid failure on native extension build -grpcio==1.41.0 -libcst<0.4 -git+https://github.com/JanssenProject/jans@62b82583a211ceba7abaaf4fef5a118d1dec9ef8#egg=jans-pycloudlib&subdirectory=jans-pycloudlib diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow.jmx deleted file mode 100644 index 98764a4ac5b..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow.jmx +++ /dev/null @@ -1,925 +0,0 @@ - - - - - - false - true - - - - host - - = - - - scope - openid profile email user_name - = - - - username - test_user - = - - - password - test_user_password - = - - - redirect_uri - https://{$host}/identity/authentication/authcode - = - - - client_id - @!5A58.AE0D.D383.1E46!0001!E38B.7DBE!0008!FF81!2D39 - = - - - client_secret - u95PC0MsrVGi - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - - - https - - - 6 - - - - continue - - false - 1 - - 3 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - false - false - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - code - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - https - - /oxauth/restv1/authorize - GET - true - false - true - false - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - javax.faces.FormSignature - ${javax.faces.FormSignature} - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - Login - = - true - - - true - javax.faces.ViewState - ${javax.faces.ViewState} - = - true - - - - - 443 - - - https - UTF-8 - /oxauth/login - POST - true - false - true - false - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - double weight = 0.7d; - -String username1 = "admin"; -String password1 = "cedevgluuorgazar"; - -String username = "test_user"; -String password = "test_user_password"; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - username = username1; - password = password1; -} - -log.info("username: " + username); - -vars.put("username", username); -vars.put("password", password); - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - code - - Assertion.sample_label - false - 2 - - - - - - - String code = ""; -if (prev.getUrlAsString().contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(prev.getUrlAsString(), "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code); - - - - - java - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /oxauth/restv1/userinfo - POST - true - false - true - false - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - 3 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_amazon.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_amazon.jmx deleted file mode 100644 index 9c1fff392e5..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_amazon.jmx +++ /dev/null @@ -1,1070 +0,0 @@ - - - - - - false - true - - - - host - m32xlarge.gluu.info - = - - - scope - openid profile email user_name - = - - - username - user_name - = - - - password - user_password - = - - - redirect_uri - https://m32xlarge.gluu.info/identity/authentication/authcode - = - - - client_id - @!607E.6278.FF17.E8E2!0001!53B7.65D1!0008!A950.A138 - = - - - client_secret - client_secret - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - -1 - - 20 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - true - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - code - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - - - /oxauth/restv1/authorize - GET - true - false - true - false - HttpClient4 - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:1" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - javax.faces.FormSignature - ${javax.faces.FormSignature} - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - Login - = - true - - - true - javax.faces.ViewState - ${javax.faces.ViewState} - = - true - - - - - - - - - UTF-8 - /oxauth/login - POST - true - false - true - false - HttpClient4 - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -//String username = "user" + userNumber; -String username = "admin"; - -log.info("username: " + username); - -vars.put("username", username); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - code - - Assertion.sample_label - false - 2 - - - - - - - String code = ""; -if (prev.getUrlAsString().contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code + ", url:" + prev.getUrlAsString()); - - - - - java - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /oxauth/restv1/userinfo - POST - true - false - true - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_amazon_client_credentials.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_amazon_client_credentials.jmx deleted file mode 100644 index 9550e2d34f1..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_amazon_client_credentials.jmx +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - false - true - - - - host - m32xlarge.gluu.info - = - - - scope - openid profile email user_name - = - - - username - user_name - = - - - password - user_password - = - - - redirect_uri - https://m32xlarge.gluu.info/identity/authentication/authcode - = - - - client_id - @!607E.6278.FF17.E8E2!0001!53B7.65D1!0008!A950.A138 - = - - - client_secret - client_secret - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - -1 - - 20 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - false - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - false - client_credentials - = - true - grant_type - - - false - clientinfo - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); - -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - - - id_token - $.id_token - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 5 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_ce-dev5.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_ce-dev5.jmx deleted file mode 100644 index dae451964fc..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_ce-dev5.jmx +++ /dev/null @@ -1,1317 +0,0 @@ - - - - - - false - true - - - - host - ce-dev5.gluu.org - = - - - scope - openid profile email user_name - = - - - username - admin - = - - - password - - = - - - redirect_uri - https://ce-dev5.gluu.org/identity/authcode.htm - = - - - client_id - 0008-5d22c743-88da-4471-b853-0cb9bb41a3d6 - = - - - client_secret - - = - - - client_header - to_override_in_jsr223 - = - - - location_regexp - Location: https:\/\/ce-dev5\.gluu\.org(.*) - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - 1 - - 1 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - true - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - code - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - https - - /oxauth/restv1/authorize - GET - true - false - false - false - HttpClient4 - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - usernameField - <input id="loginForm:username" name="(.+?)" type="text" - $1$ - UNKNOWN - 1 - - - - false - userpasswordField - <input id="loginForm:password" name="(.+?)" type="password" - $1$ - UNKNOWN - 1 - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - ${usernameField} - ${username} - = - true - - - true - ${userpasswordField} - ${password} - = - true - - - true - loginForm:loginButton - - = - true - - - true - javax.faces.ViewState - stateless - = - true - - - false - {"description":"Chrome 67.0.3396.99 on Windows Server 2008 R2 / 7 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36","version":"67.0","os":{"architecture":64,"family":"Windows Server 2008 R2 / 7","version":"7"}} - = - true - loginForm:platform - - - - - 443 - - - https - UTF-8 - /oxauth/login.htm - POST - false - false - false - false - HttpClient4 - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "user" + userNumber; -String username = "test_user"; - -//log.info("username: " + username); - -//vars.put("username", username); - -log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - false - true - true - false - - - - - true - 2 - - - - - - - - 443 - - - - - ${redirect_to} - GET - false - false - true - false - false - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - - - - String code = ""; -String redirectTo = vars.get("redirect_to"); -if (redirectTo.contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code + ", redirect_to:" + redirectTo); - - java - - - - true - true - true - true - - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - - - /oxauth/restv1/token - POST - true - false - false - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /oxauth/restv1/userinfo - POST - true - false - false - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_jans.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_jans.jmx deleted file mode 100644 index e697318fde1..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_jans.jmx +++ /dev/null @@ -1,1315 +0,0 @@ - - - - - - false - true - - - - host - yuriyz-modern-gnat.gluu.info - = - - - scope - openid profile email user_name - = - - - username - admin - = - - - password - 7IiUu*5/HA8H - = - - - redirect_uri - https://yuriyz-modern-gnat.gluu.info/ - = - - - client_id - 37d82f27-39f2-423d-85a0-1449b4378b26 - = - - - client_secret - 559b78b9-94c1-4f47-8cb6-7101a456432b - = - - - client_header - to_override_in_jsr223 - = - - - location_regexp - Location: https:\/\/yuriyz-modern-gnat\.gluu\.info(.*) - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - 1 - - 1 - 1 - 1479823133000 - 1479823133000 - false - - - true - - - - - - true - false - false - - - - - true - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - code - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - https - - /jans-auth/restv1/authorize - GET - true - false - false - false - HttpClient4 - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - usernameField - <input id="loginForm:username" name="(.+?)" type="text" - $1$ - UNKNOWN - 1 - - - - false - userpasswordField - <input id="loginForm:password" name="(.+?)" type="password" - $1$ - UNKNOWN - 1 - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - Login - = - true - - - true - jakarta.faces.ViewState - stateless - = - true - - - false - {"description":"Chrome 67.0.3396.99 on Windows Server 2008 R2 / 7 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36","version":"67.0","os":{"architecture":64,"family":"Windows Server 2008 R2 / 7","version":"7"}} - = - true - loginForm:platform - - - - - 443 - - - https - UTF-8 - /jans-auth/login.htm - POST - false - false - false - false - HttpClient4 - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - true - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "test_user" + userNumber; - -//log.info("username: " + username); - -vars.put("username", username); - -log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - false - true - true - false - - - - - true - 2 - - - - - - - - 443 - - - - - ${redirect_to} - GET - false - false - true - false - false - - - - - true - redirect_to - ${location_regexp} - $1$ - NOT_FOUND - 1 - all - - - - true - - - String code = ""; -String redirectTo = vars.get("redirect_to"); -if (redirectTo.contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(redirectTo, "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code + ", redirect_to:" + redirectTo); - - java - - - - true - true - true - true - - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - - - /jans-auth/restv1/token - POST - true - false - false - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - true - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /jans-auth/restv1/userinfo - POST - true - false - false - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - true - - - - - false - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - true - - - - - true - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - true - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_xeon.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_xeon.jmx deleted file mode 100644 index aee4e86f99d..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_xeon.jmx +++ /dev/null @@ -1,1242 +0,0 @@ - - - - - - false - true - - - - host - xeon.gluu.info - = - - - scope - openid profile email user_name - = - - - username - user - = - - - password - 9lQoXSINUsnP - = - - - redirect_uri - https://xeon.gluu.info/identity/authentication/authcode - = - - - client_id - @!4878.7FE9.4A9F.E325!0001!914D.74AF!0008!6F80.938F.A950.A138 - = - - - client_secret - client_secret - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - 2 - - 30 - 4 - 1479823133000 - 1479823133000 - false - - - - - - - - true - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - code - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - https - - /oxauth/restv1/authorize - GET - true - false - false - false - HttpClient4 - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - javax.faces.FormSignature - ${javax.faces.FormSignature} - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - Login - = - true - - - true - javax.faces.ViewState - ${javax.faces.ViewState} - = - true - - - - - 443 - - - https - UTF-8 - /oxauth/login - POST - true - false - false - false - HttpClient4 - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "user" + userNumber; -String username = "admin"; - -log.info("username: " + username); - -vars.put("username", username); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - code - - Assertion.sample_label - false - 2 - - - - - - - String code = ""; -if (prev.getUrlAsString().contains("?code=")) { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "?code="); -} else { - code = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "&code="); -} -if (code.contains("&")) { - code = org.apache.commons.lang3.StringUtils.substringBefore(code, "&"); -} - -vars.put("code", code); -log.info("login post processor, code : " + code + ", url:" + prev.getUrlAsString()); - - - - - java - - - - - - - - false - ${code} - = - true - code - - - false - authorization_code - = - true - grant_type - - - false - ${redirect_uri} - = - true - redirect_uri - - - - - - - - - - /oxauth/restv1/token - POST - true - false - false - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /oxauth/restv1/userinfo - POST - true - false - false - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Authorization Code Flow_xeon_client_credentials.jmx b/demos/load-testing/jmeter/test/Authorization Code Flow_xeon_client_credentials.jmx deleted file mode 100644 index 7e7c69cb686..00000000000 --- a/demos/load-testing/jmeter/test/Authorization Code Flow_xeon_client_credentials.jmx +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - false - true - - - - host - xeon.gluu.info - = - - - scope - openid profile email user_name - = - - - username - user - = - - - password - 9lQoXSINUsnP - = - - - redirect_uri - https://xeon.gluu.info/identity/authentication/authcode - = - - - client_id - @!4878.7FE9.4A9F.E325!0001!914D.74AF!0008!6F80.938F.A950.A138 - = - - - client_secret - client_secret - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 30000 - 30000 - https - - - HttpClient4 - 6 - - - - continue - - false - 5000 - - 50 - 1 - 1479823133000 - 1479823133000 - false - - - - - - - - false - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - false - client_credentials - = - true - grant_type - - - false - clientinfo - = - true - scope - - - - - - - - https - - /oxauth/restv1/token - POST - true - false - true - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); - -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 5 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - diff --git a/demos/load-testing/jmeter/test/Implicit_Flow_benchmark_gluu_org.jmx b/demos/load-testing/jmeter/test/Implicit_Flow_benchmark_gluu_org.jmx deleted file mode 100644 index f50d3434218..00000000000 --- a/demos/load-testing/jmeter/test/Implicit_Flow_benchmark_gluu_org.jmx +++ /dev/null @@ -1,1018 +0,0 @@ - - - - - - false - true - - - - host - benchmark.gluu.org - = - - - scope - openid profile email user_name - = - - - username - user1 - = - - - password - secret - = - - - redirect_uri - https://benchmark.gluu.org/identity/authentication/authcode - = - - - client_id - @!7FCA.5782.1BC9.0C1D!0001!E6EE.DFB0!0008!EB0A.2783 - = - - - client_secret - 4Dyh1YpQTJmT - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - -1 - - 2 - 4 - 1479823133000 - 1479823133000 - false - - - - - - - - true - false - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 1 - - 1 - session_state_counter - - false - - - - - - - true - ${scope} - = - true - scope - - - false - token id_token - = - true - response_type - - - false - nonce - = - true - nonce - - - true - ${redirect_uri} - = - true - redirect_uri - - - true - ${client_id} - = - true - client_id - - - - - - - - https - - /oxauth/restv1/authorize - GET - true - false - false - false - HttpClient4 - false - - - - - false - javax.faces.FormSignature - <input type="hidden" name="javax.faces.FormSignature" value="(.+?)" /> - $1$ - - - - - - false - javax.faces.ViewState - <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" autocomplete="off" /> - $1$ - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - - false - loginForm - loginForm - = - true - - - true - loginForm:username - ${username} - = - true - - - true - loginForm:password - ${password} - = - true - - - true - loginForm:loginButton - Login - = - true - - - true - javax.faces.ViewState - stateless - = - true - - - - - 443 - - - https - UTF-8 - /oxauth/login - POST - true - false - false - false - HttpClient4 - false - - Detected the start of a redirect chain - - - - - - Content-Type - application/x-www-form-urlencoded - - - Accept-Language - en-US,en;q=0.5 - - - Accept - text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - - - User-Agent - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 - - - Referer - https://${host}/oxauth/login - - - Accept-Encoding - gzip, deflate - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - double weight = 0.8d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 99999; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "user" + userNumber; - -log.info("username: " + username); - -vars.put("username", username); - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - String token = ""; -if (prev.getUrlAsString().contains("#access_token=")) { - token = org.apache.commons.lang3.StringUtils.substringAfter(prev.getUrlAsString(), "#access_token="); -} -if (token.contains("&")) { - token = org.apache.commons.lang3.StringUtils.substringBefore(token, "&"); -} - -vars.put("access_token", token); -log.info("login post processor, access_token : " + token + ", url:" + prev.getUrlAsString()); - - - - - java - - - - String accessToken = vars.get("access_token"); -boolean result = org.apache.commons.lang3.StringUtils.isBlank(accessToken); -Failure = result; -log.info("bean asserter, result : " + result + ", access_token: " + accessToken); - - - false - - - - - - access_token - - - Assertion.sample_label - false - 2 - variable - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - - - - - false - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - - - - - true - standard - org.apache.jmeter.protocol.http.control.HC4CookieHandler - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - 5747dfc9-3b64-496f-947f-e9ce907c06cd - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/ResourceOwnerPasswordCredentials_jans.jmx b/demos/load-testing/jmeter/test/ResourceOwnerPasswordCredentials_jans.jmx deleted file mode 100644 index fd145fa4a77..00000000000 --- a/demos/load-testing/jmeter/test/ResourceOwnerPasswordCredentials_jans.jmx +++ /dev/null @@ -1,966 +0,0 @@ - - - - - - false - true - - - - host - yuriyz-modern-gnat.gluu.info - = - - - scope - openid profile email user_name - = - - - username - admin - = - - - password - 7IiUu*5/HA8H - = - - - client_id - 37d82f27-39f2-423d-85a0-1449b4378b26 - = - - - client_secret - 559b78b9-94c1-4f47-8cb6-7101a456432b - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - 1 - - 1 - 1 - 1479823133000 - 1479823133000 - false - - - true - - - - - - true - false - false - - - - - true - - - - 1 - - 1 - session_state_counter - - false - - - - - - - false - password - = - true - grant_type - - - false - ${username} - = - true - username - - - false - ${password} - = - true - password - - - - - - - - - - /jans-auth/restv1/token - POST - true - false - false - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - true - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "test_user" + userNumber; - -//log.info("username: " + username); - -vars.put("username", username); - -log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); - - - - - true - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /jans-auth/restv1/userinfo - POST - true - false - false - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - true - - - - - false - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - true - - - - - true - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - true - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/authorization/ResourceOwnerPasswordCredentials_jans.jmx b/demos/load-testing/jmeter/test/authorization/ResourceOwnerPasswordCredentials_jans.jmx deleted file mode 100644 index fd145fa4a77..00000000000 --- a/demos/load-testing/jmeter/test/authorization/ResourceOwnerPasswordCredentials_jans.jmx +++ /dev/null @@ -1,966 +0,0 @@ - - - - - - false - true - - - - host - yuriyz-modern-gnat.gluu.info - = - - - scope - openid profile email user_name - = - - - username - admin - = - - - password - 7IiUu*5/HA8H - = - - - client_id - 37d82f27-39f2-423d-85a0-1449b4378b26 - = - - - client_secret - 559b78b9-94c1-4f47-8cb6-7101a456432b - = - - - client_header - to_override_in_jsr223 - = - - - - - - - - - - - ${host} - - 60000 - 60000 - https - - - HttpClient4 - 6 - - - - continue - - false - 1 - - 1 - 1 - 1479823133000 - 1479823133000 - false - - - true - - - - - - true - false - false - - - - - true - - - - 1 - - 1 - session_state_counter - - false - - - - - - - false - password - = - true - grant_type - - - false - ${username} - = - true - username - - - false - ${password} - = - true - password - - - - - - - - - - /jans-auth/restv1/token - POST - true - false - false - false - HttpClient4 - false - - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - true - double weight = 0.7d; - -int min = 1; -int max = 1000; - -int minX = 1001; -int maxX = 100000; - -float chance = new Random().nextFloat(); -if (chance <= weight) { - min = minX; - max = maxX; -} - -int userNumber = new Random().nextInt(max - min + 1) + min; -String username = "test_user" + userNumber; - -//log.info("username: " + username); - -vars.put("username", username); - -log.info("username: " + vars.get("username") + ", password: " + vars.get("password")); - - - - - true - - - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - java - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - "access_token" - - Assertion.response_data - false - 2 - - - - - access_token - $.access_token - - - - - id_token - $.id_token - - - - - - - - - false - ${access_token} - = - true - access_token - - - - - - - - - - /jans-auth/restv1/userinfo - POST - true - false - false - false - HttpClient4 - false - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; -import org.apache.jmeter.testelement.property.JMeterProperty; -import org.apache.jmeter.testelement.property.CollectionProperty; - -CookieManager manager = sampler.getCookieManager(); -CollectionProperty collectionProperty = manager.getCookies(); -log.info("cookie collectionProperty : " + collectionProperty + ", size: " + collectionProperty.size()); - -Object session_state_counter = vars.get("session_state_counter"); -log.info("session_state_counter : " + session_state_counter); - -for (int i = 0; i < collectionProperty.size(); i++) { - JMeterProperty p = collectionProperty.get(i); - - if ("session_state".equals(p.getName())) { - //log.info("session_state : " + p.getObjectValue().getValue() + ", id_token: " + vars.get("id_token")); - props.put("oic.session_state." + session_state_counter, p.getObjectValue().getValue()); - props.put("oic.id_token." + session_state_counter, vars.get("id_token")); - log.info("props session_state : " + props.get("oic.session_state." + session_state_counter)); - log.info("props id_token : " + props.get("oic.id_token." + session_state_counter)); - } -} - - - - - - - - - - 60000 - 60000 - - - - 6 - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - - continue - - false - -1 - - 1 - 1 - 1480924764000 - 1480924764000 - false - - 3 - true - - - - - false - - - - 3000 - - - - - - - false - ${id_token} - = - true - id_token_hint - - - - - - - - - - - GET - true - false - true - false - false - - - - - java - - - true - import org.apache.jmeter.protocol.http.control.CookieManager; -import org.apache.jmeter.protocol.http.control.Cookie; - -CookieManager manager = sampler.getCookieManager(); - -for (Map.Entry entry : props.entrySet()) { - if (entry.getKey() instanceof String) { - String key = entry.getKey(); - if (key.startsWith("oic.session_state.")) { - String counter = key.substring("oic.session_state.".length()); - - log.info("PRE end session, counter : " + counter + ", session_state: " + entry.getValue() + ", props.getProperty(): " + props.getProperty("oic.session_state." + counter)); - - Cookie cookie = new Cookie("session_state", entry.getValue(), vars.get("host"), "/", false, 0); - manager.add(cookie); - - Object idToken = props.getProperty("oic.id_token." + counter); - log.info("PRE end session, id_token : " + idToken); - vars.put("id_token", idToken); - - props.remove("oic.session_state." + counter); - props.remove("oic.id_token." + counter); - break; - } - } -} - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - continue - - false - 1 - - 2000 - 5 - 1482159304000 - 1482159304000 - false - - - true - - - - - true - - - - - - Authorization - ${client_header} - - - Content-Type - application/x-www-form-urlencoded - - - - - - java - - - true - String credentials = vars.get("client_id") + ":" + vars.get("client_secret"); -String clientHeader = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(credentials.getBytes("UTF-8")); -log.info("Credentials: " + credentials + ", clientHeader: " + clientHeader); -OUT.println("Credentials: " + credentials + ", clientHeader: " + clientHeader); -vars.put("client_header", clientHeader); - - - - - - - false - client_credentials - = - true - grant_type - - - false - ${client_id} - = - true - client_id - - - false - ${scope} - = - true - scope - - - - - - - - - - /oxauth/restv1/token - POST - true - false - true - false - false - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - false - true - false - false - false - true - 0 - true - true - true - - - - - - - - - diff --git a/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization - testing data.csv b/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization - testing data.csv deleted file mode 100644 index 947a826d225..00000000000 --- a/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization - testing data.csv +++ /dev/null @@ -1,3 +0,0 @@ -test_user1,test,@!1111!0008!0001.0001,11111111-1111-1111-1111-111111111111,https://client.example.com/cb,openid profile email,aa0ifjsldkj -test_user2,test,@!1111!0008!0001.0001,11111111-1111-1111-1111-111111111111,https://client.example.com/cb,openid profile email,aa0ifjsldkj -test_user3,test,@!1111!0008!0001.0001,11111111-1111-1111-1111-111111111111,https://client.example.com/cb,openid profile email,aa0ifjsldkj diff --git a/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization.jmx b/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization.jmx deleted file mode 100644 index 487c8426ceb..00000000000 --- a/demos/load-testing/jmeter/test/authorization/oxServer - Test user authorization.jmx +++ /dev/null @@ -1,712 +0,0 @@ - - - - - - false - false - - - - - - - - continue - - false - 1000 - - 10 - 0 - 1343667367000 - 1343667367000 - false - - - - - - - - oxServer - Test user authorization - testing data.csv - - USER,USER_PASSWORD,CLIENT_ID,CLIENT_PASSWORD,REDIRECT_URI,SCOPE,STATE - , - false - true - false - All threads - - - - - - function encodeBase64(str){ - var chr1, chr2, chr3, rez = '', arr = [], i = 0, j = 0, code = 0; - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''); - - while(code = str.charCodeAt(j++)){ - if(code < 128){ - arr[arr.length] = code; - } - else if(code < 2048){ - arr[arr.length] = 192 | (code >> 6); - arr[arr.length] = 128 | (code & 63); - } - else if(code < 65536){ - arr[arr.length] = 224 | (code >> 12); - arr[arr.length] = 128 | ((code >> 6) & 63); - arr[arr.length] = 128 | (code & 63); - } - else{ - arr[arr.length] = 240 | (code >> 18); - arr[arr.length] = 128 | ((code >> 12) & 63); - arr[arr.length] = 128 | ((code >> 6) & 63); - arr[arr.length] = 128 | (code & 63); - } - }; - - while(i < arr.length){ - chr1 = arr[i++]; - chr2 = arr[i++]; - chr3 = arr[i++]; - - rez += chars[chr1 >> 2]; - rez += chars[((chr1 & 3) << 4) | (chr2 >> 4)]; - rez += chars[chr2 === undefined ? 64 : ((chr2 & 15) << 2) | (chr3 >> 6)]; - rez += chars[chr3 === undefined ? 64 : chr3 & 63]; - }; - return rez; -}; - -vars.put("BASIC_AUTH", encodeBase64(vars.get("USER") + ':' + vars.get("USER_PASSWORD"))); -vars.put("CLIENT_AUTH", encodeBase64(vars.get("CLIENT_ID") + ':' + vars.get("CLIENT_PASSWORD"))); - - javascript - - - - - - - - localhost - 8080 - - - http - - /oxauth - 4 - - - - - true - - - - - - - - Authorization - Basic ${BASIC_AUTH} - - - Accept - text/plain - - - - - - - - - true - code - = - true - response_type - - - true - ${CLIENT_ID} - = - true - client_id - - - true - ${REDIRECT_URI} - = - true - redirect_uri - - - true - ${SCOPE} - = - true - scope - - - true - ${STATE} - = - true - state - - - - - - - - - - /oxauth/restv1/authorize - GET - false - false - true - false - false - - - - - - 302 - - Assertion.response_code - false - 8 - - - - - ${REDIRECT_URI} - code= - scope= - state= - - Assertion.response_headers - false - 2 - - - - true - AUTHORIZATION_CODE - code=(\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12}) - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - AUTHORIZATION_CODE - - - - true - AUTHORIZATION_SCOPE - scope=([\w|\+]+) - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - AUTHORIZATION_SCOPE - - - - true - AUTHORIZATION_STATE - state=(\w+) - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - AUTHORIZATION_STATE - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - - - - - - Authorization - Basic ${CLIENT_AUTH} - - - Content-Type - application/x-www-form-urlencoded - - - - - - - - - true - authorization_code - = - true - grant_type - - - true - ${AUTHORIZATION_CODE} - = - true - code - - - true - ${REDIRECT_URI} - = - true - redirect_uri - - - - - - - - - - /oxauth/restv1/token - POST - false - false - true - false - false - - - - - - 200 - - Assertion.response_code - false - 8 - - - - - Cache-Control: no-store, private - Pragma: no-cache - Content-Type: application/json - - Assertion.response_headers - false - 2 - - - - - access_token - token_type - refresh_token - id_token - - Assertion.response_data - false - 2 - - - - unescaped - ACCESS_TOKEN - "access_token":"(\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12})" - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - ACCESS_TOKEN - - - - unescaped - REFRESH_TOKEN - "refresh_token":"(\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12})" - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - REFRESH_TOKEN - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - - - - - - Content-Type - application/x-www-form-urlencoded - - - - - - - - - true - ${ACCESS_TOKEN} - = - true - access_token - - - true - ${REDIRECT_URI} - = - true - redirect_uri - - - true - ${AUTHORIZATION_STATE} - = - true - state - - - - - - - - - - /oxauth/restv1/end_session - GET - false - false - true - false - false - - - - - - 302 - - Assertion.response_code - false - 8 - - - - - ${REDIRECT_URI} - state= - - Assertion.response_headers - false - 2 - - - - true - LOGOUT_STATE - state=(\w) - $1$ - NOT_FOUND - 1 - - - - - NOT_FOUND - - Assertion.response_headers - false - 12 - variable - LOGOUT_STATE - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - false - - saveConfig - - - true - true - true - - true - true - true - true - false - true - true - false - false - true - false - false - false - false - false - 0 - true - - - - - - - - - diff --git a/docs/admin/planning/benchmarking.md b/docs/admin/planning/benchmarking.md index 585cb8a192b..bac7dbe74b0 100644 --- a/docs/admin/planning/benchmarking.md +++ b/docs/admin/planning/benchmarking.md @@ -105,7 +105,7 @@ Download or build [config-cli-tui](../config-guide/tui.md) and run: ``` 1. Create users by pattern: -Set the following [env vars](../../../demos/benchmarking/docker-loadtesting-jmeter/README.md#loading-users) +Set the following [env vars](../../../demos/benchmarking/docker-jans-loadtesting-jmeter/README.md#loading-users) | ENV | Example | |------------------------------|--------------------| @@ -119,7 +119,7 @@ Set the following [env vars](../../../demos/benchmarking/docker-loadtesting-jmet | `USER_NUMBER_ENDING_POINT` | 10000 | -Run the following script [add_sequenced_jans_user_rdbm.py](../../../demos/benchmarking/docker-loadtesting-jmeter/scripts/add_users_rdbm.py) +Run the following script [add_sequenced_jans_user_rdbm.py](../../../demos/benchmarking/docker-jans-loadtesting-jmeter/scripts/add_users_rdbm.py) **Threads&RampUp** diff --git a/docs/admin/recipes/benchmark.md b/docs/admin/recipes/benchmark.md new file mode 100644 index 00000000000..b151c37035b --- /dev/null +++ b/docs/admin/recipes/benchmark.md @@ -0,0 +1,279 @@ +--- +tags: + - administration + - helm + - kubernetes + - benchmarking +--- + +# Overview + +The Gluu Server has been optimized with several container strategies that allow scaling micro-services and orchestrating them using Kubernetes. In this tutorial we will be running a load test from three different regions on a janssen setup on three different regions. For simplicity, we will be using [microk8s](https://microk8s.io) however we do recommend users to use the kubernetes cluster providers that they will be using in production. For instance, we run our loadtests across EKS, GKE, AKS and DOKS. + +With this procedure you can expect to get the [following](#results) with a `10` million user database: + +#### Results + +!!!note + The authorization code flow hits a total of 4 steps, 3 authorization steps `/token`, `/authorize`, `/oxauth/login` and 1 redirect. + +| Flow | Authentications per second | +|-------------------------|----------------------------| +| Authorization code flow | 800-1000 | + + +## Installation + +As mentioned in the overview we recommend you use the same Kubernetes cluster as you are planning in production. You can find guides to install on different clouds [here](../install/helm-install/README.md). + +### Persistence + +We recommend your persistence in production to be HA, backup supported and point in time recovery supported. + +| Persistence | # of nodes | RAM(GiB) | CPU | Total RAM (GiB) | Total CPU | +|------------------|------------|----------|-----|-----------------|-----------| +| MySQL | 1 | 52 | 8 | 52 | 8 | + +### Set up the cluster + +#### Kubernetes Cluster Load Test Resources + +!!!note + Instance type can be selected to best suit the deployment intended. Keep in mind when selecting the instance type to strive for a `10` or up to `10` network bandwidth (Gbps). Above details the exact resources needed for this tutorial. + +Resourcing is critical as timeouts in connections can occur, resulting in failed authentications or cutoffs. + +| Regions | # of nodes | RAM(GiB) | CPU | Total RAM (GiB) | Total CPU | +|-------------|------------|----------|-----|-----------------|-----------| +| US-West | 1 | 96 | 48 | 96 | 48 | +| US-East | 1 | 96 | 48 | 96 | 48 | +| EU-Central | 1 | 96 | 48 | 96 | 48 | +| Grand Total | | | | 288 GB | 144 | + + +You may choose to create a cluster with three nodes or more in one region and that's fine as long as the nodes are in multiple zones. We will continue with the above table and using microk8s. + + +1. Create three ubuntu 22.04 nodes and run on each one the following: + + ```bash + sudo snap install microk8s --classic + sudo snap alias microk8s.kubectl kubectl + ``` +2. Designate on of the nodes as the master. We will choose the us-west node to be our master. On the master node run: + + * Execute : + ```bash + microk8s.enable ingress dashboard observability dns metrics-server hostpath-storage registry + ``` + + * All the other microk8s nodes must be resolvable from within the master. If you are not using registered fqdns open the `/etc/hosts` file in the master node and map each hostname of the other nodes. You can get the hostname of the other nodes by executing the command `hostname`. + ```bash + # On master + echo "192.123.123.123 ubuntu-us-east" >> /etc/hosts + echo "192.124.124.124 ubuntu-eu-central" >> /etc/hosts + ``` + * Execute: + ```bash + microk8s add-node + ``` + + Copy the output of the command above with `--worker` i.e `microk8s join 192.12.12.12:25000/88687d1cc5ecdee0db5014c4df9b82cb/adedf6a730eb --worker` and execute it in the other nodes to join them. You may need to reexecute step `2` for each worker node. + +3. Make sure [helm](https://helm.sh/docs/intro/install/) is installed. + +4. Prepare your [override.yaml](../install/helm-install/README.md). Copy the below into a file named override.yaml. At the time of writing this we are using image tags `1.0.6_dev` which are the bleeding edge images for release `1.0.6`. You should use stable images such as `1.0.6-1`. + ```yaml + config: + image: + repository: janssenproject/configurator + tag: 1.0.6_dev + countryCode: US + email: support@gluu.org + orgName: Gluu + city: Austin + configmap: + cnSqlDbName: test + cnSqlDbPort: 3306 + cnSqlDbDialect: mysql + cnSqlDbHost: mycool.cloud.mysql + cnSqlDbUser: root + cnSqlDbTimezone: UTC + cnSqldbUserPassword: Test1234# + global: + auth-server: + enabled: true + config-api: + enabled: true + cnPersistenceType: sql + cloud: + testEnviroment: false + fqdn: example.gluu.info + isFqdnRegistered: true + # In the event the fqdn above is not resolvable from the internet comment the above line and uncomment the below two setting your lbIp to your master ndoe ip. + #isFqdnRegistered: false + #lbIp: 192.12.12.12 + istio: + enabled: false + ingress: false + nginx-ingress: + enabled: true + fido2: + enabled: false + ingress: + fido2ConfigEnabled: false + scim: + enabled: false + ingress: + scimConfigEnabled: false + scimEnabled: false + auth-server: + image: + pullPolicy: IfNotPresent + repository: janssenproject/auth-server + tag: 1.0.6_dev + config-api: + image: + pullPolicy: IfNotPresent + repository: janssenproject/config-api + tag: 1.0.6_dev + persistence: + image: + pullPolicy: IfNotPresent + repository: janssenproject/persistence-loader + tag: 1.0.6_dev + nginx-ingress: + ingress: + path: / + hosts: + - example.gluu.info + tls: + - secretName: tls-certificate + hosts: + - example.gluu.info + ``` + +5. Run the following: + ```bash + kubectl create ns jans + helm repo add janssen https://docs.jans.io/charts + helm repo update + helm install janssen janssen/janssen -n jans -f override.yaml + ``` + +### Load-test + +Our tests used 10 million users that were loaded. We have created a docker image to load users. That same image is also used to load test Janssen using jmeter tests for the `Authorization code` flow. More tests will come!. This image will load users and use a unique password for each user. + +#### Loading users + +1. Create a folder called `add_users`. + + ```bash + mkdir add_users && cd add_users + ``` +2. Copy the following [yaml](https://github.com/JanssenProject/jans/blob/main/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml) into the folder under the name `load_users.yaml`. + +3. Open the file and modify the sql connection parameters + +4. Create a namespace for load-testing. + + ```bash + kubectl create ns load + ``` + +5. Create `load_users.yaml` + + ```bash + kubectl create -f load_users.yaml -n load + ``` + +Wait until all the users are up before moving forward. + +#### Load testing + +##### Authorization code client + +###### Resources needed for Authorization code client jmeter test + +| NAME | # of pods | RAM(GiB) | CPU | Total RAM(GiB) | Total CPU | +|-------------------------------------|-----------|----------|-----|----------------|-----------| +| Authorization code flow jmeter test | 20 | 8 | 1.3 | 190 | 24 | +| Grand Total | | | | 190 GiB | 24 | + +###### Setup Client + +Create the client needed to run the test by executing the following. Make sure to change the `FQDN` : + +1. Create a folder called `load_test`. + + ```bash + mkdir load_test && cd load_test + ``` + +2. Create the client json file + + ```bash + FQDN=example.gluu.info + cat << EOF > auth_code_client.json + { + "dn": null, + "inum": null, + "displayName": "Auth Code Flow Load Test Client", + "redirectUris": [ + "https://$FQDN" + ], + "responseTypes": [ + "id_token", + "code" + ], + "grantTypes": [ + "authorization_code", + "implicit", + "refresh_token" + ], + "tokenEndpointAuthMethod": "client_secret_basic", + "scopes": [ + "openid", + "profile", + "email", + "user_name" + ], + "trustedClient": true, + "includeClaimsInIdToken": false, + "accessTokenAsJwt": false, + "disabled": false, + "deletable": false, + "description": "Auth Code Flow Load Testing Client" + } + EOF + ``` +3. Copy the following [yaml](https://github.com/JanssenProject/jans/blob/main/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-test/load_test_auth_code.yaml) into the folder. + +4. Download or build [config-cli-tui](../config-guide/tui.md) and run: + + ```bash + # Notice the namespace is jans here . Change it if you changed it previously + ROLE_BASED_CLIENT_ID=$(kubectl get cm cn -o json -n jans | grep '"role_based_client_id":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]') + ROLE_BASED_CLIENT_SECRET=$(kubectl get secret cn -o json -n jans | grep '"role_based_client_pw":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d) + # add -noverify if your fqdn is not registered + ./config-cli-tui.pyz --host $FQDN --client-id $ROLE_BASED_CLIENT_ID --client-secret $ROLE_BASED_CLIENT_SECRET --no-tui --operation-id=post-oauth-openid-client --data=auth_code_client.json + ``` + +5. Save the client id and secret from the response and enter them along with your FQDN in the yaml file `load_test_auth_code.yaml` under `AUTHZ_CLIENT_ID`, `AUTHZ_CLIENT_SECRET` and `FQDN` respectively then execute : + + ```bash + kubectl apply -f load_test_auth_code.yaml + ``` + +6. The janssen setup by default installs an HPA which will automatically scale your pods if the metrics server is installed according to traffic. If you would like to load it very quickly scale the auth-server manually: + ```bash + kubectl scale deploy janssen-auth-server -n jans --replicas=40 + ``` + +7. Finally, scale the load test. You must control this replica number. + ```bash + kubectl scale deploy load-testing -n load --replicas=20 + ``` + + diff --git a/mkdocs.yml b/mkdocs.yml index 7dd6d2adba4..a6d5a2b3eed 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -463,6 +463,7 @@ nav: - 'Plugins': 'admin/config-api/plugins.md' - 'Janssen Recipes': - 'admin/recipes/README.md' + - 'Benchmark': /admin/recipes/benchmark.md - 'Returning Group/Role User Information': 'admin/recipes/returning-group.md' - 'Passwordless': 'admin/recipes/passwordless.md' - 'Forcing Re-Authentication': 'admin/recipes/forcing-reauthn.md' From f080e4219a58f23f4b02722c7d67c1728a5a1490 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Mon, 2 Jan 2023 08:54:03 +0000 Subject: [PATCH 10/11] ci: fix conditional on updating dates inside dockerfile --- .github/workflows/docker_build_image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_build_image.yml b/.github/workflows/docker_build_image.yml index 608a5948fec..69b4780d068 100644 --- a/.github/workflows/docker_build_image.yml +++ b/.github/workflows/docker_build_image.yml @@ -126,13 +126,13 @@ jobs: # UPDATE BUILD DATES INSIDE THE DOCKERFILE BEFORE BUILDING THE DEV IMAGES TRIGGERED BY JENKINS - name: Setup Python 3.7 - if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} != 'loadtesting-jmeter' uses: actions/setup-python@v4 with: python-version: 3.7 - name: Install Python dependencies - if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} != 'loadtesting-jmeter' run: | sudo apt-get update sudo python3 -m pip install --upgrade pip @@ -142,7 +142,7 @@ jobs: sudo apt-get install jq - name: Update Build date in Dockerfile - if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} == 'loadtesting-jmeter' + if: github.event_name == 'workflow_dispatch' && ${{ matrix.docker-images }} != 'loadtesting-jmeter' id: update_build_date_in_dockerfile run: | sudo python3 ./automation/auto_update_build_date.py From 04d5f4c07f40339c64fc3a9a23aa2a1a449d4ed5 Mon Sep 17 00:00:00 2001 From: moabu <47318409+moabu@users.noreply.github.com> Date: Mon, 2 Jan 2023 09:51:09 +0000 Subject: [PATCH 11/11] docs: proofreaad --- .../version.txt | 2 +- .../load-users/load_users_couchbase_job.yaml | 2 +- .../yaml/load-users/load_users_ldap_job.yaml | 2 +- .../yaml/load-users/load_users_rdbms_job.yaml | 2 +- .../load-users/load_users_spanner_job.yaml | 6 +- docs/admin/recipes/benchmark.md | 173 +++++++++--------- 6 files changed, 98 insertions(+), 89 deletions(-) diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt b/demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt index 3eefcb9dd5b..af0b7ddbffd 100644 --- a/demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/version.txt @@ -1 +1 @@ -1.0.0 +1.0.6 diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml index 504e7577699..61e23af291b 100644 --- a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_couchbase_job.yaml @@ -31,7 +31,7 @@ spec: - envFrom: - configMapRef: name: load-users-cb-cm - image: janssenproject/demo_loadtesting:1.0.0_dev + image: janssenproject/demo_loadtesting:1.0.6_dev name: load-users resources: limits: diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml index 6e07e41f5da..028c23c5bc3 100644 --- a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_ldap_job.yaml @@ -31,7 +31,7 @@ spec: - envFrom: - configMapRef: name: load-users-ldap-cm - image: janssenproject/demo_loadtesting:1.0.0_dev + image: janssenproject/demo_loadtesting:1.0.6_dev name: load-users resources: limits: diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml index aab8bdc0a99..b0517b616d0 100644 --- a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml @@ -34,7 +34,7 @@ spec: - envFrom: - configMapRef: name: load-users-mysql-cm - image: janssenproject/demo_loadtesting:1.0.0_dev + image: janssenproject/demo_loadtesting:1.0.6_dev name: load-users-mysql resources: limits: diff --git a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml index 6d308cca245..e9ffd18363a 100644 --- a/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml +++ b/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_spanner_job.yaml @@ -38,7 +38,7 @@ spec: - envFrom: - configMapRef: name: load-users-spanner-cm - image: janssenproject/demo_loadtesting:1.0.0_dev + image: janssenproject/demo_loadtesting:1.0.6_dev volumeMounts: - mountPath: /etc/certs/google_service_account.json name: google-sa @@ -47,8 +47,8 @@ spec: resources: limits: cpu: 30000m - memory: 60000Mi + memory: 5000Mi requests: cpu: 30000m - memory: 60000Mi + memory: 5000Mi restartPolicy: Never diff --git a/docs/admin/recipes/benchmark.md b/docs/admin/recipes/benchmark.md index b151c37035b..84fc23ae76a 100644 --- a/docs/admin/recipes/benchmark.md +++ b/docs/admin/recipes/benchmark.md @@ -8,14 +8,14 @@ tags: # Overview -The Gluu Server has been optimized with several container strategies that allow scaling micro-services and orchestrating them using Kubernetes. In this tutorial we will be running a load test from three different regions on a janssen setup on three different regions. For simplicity, we will be using [microk8s](https://microk8s.io) however we do recommend users to use the kubernetes cluster providers that they will be using in production. For instance, we run our loadtests across EKS, GKE, AKS and DOKS. +The Janssen Server has been optimized with several container strategies that allow scaling microservices and orchestrating them using Kubernetes. In this tutorial we will be running a load test from three different regions on a janssen setup on three different regions. For simplicity, we will be using [microk8s](https://microk8s.io) however we do recommend users to use the kubernetes cluster providers that they will be using in production. For instance, we run our loadtests across EKS, GKE, AKS and DOKS. -With this procedure you can expect to get the [following](#results) with a `10` million user database: +With this procedure the [following](#results) with a `10` million user database is expected: #### Results !!!note - The authorization code flow hits a total of 4 steps, 3 authorization steps `/token`, `/authorize`, `/oxauth/login` and 1 redirect. + The authorization code flow hits a total of 4 steps, 3 authorization steps `/token`, `/authorize`, `/jans-auth/login` and 1 redirect. | Flow | Authentications per second | |-------------------------|----------------------------| @@ -24,11 +24,11 @@ With this procedure you can expect to get the [following](#results) with a `10` ## Installation -As mentioned in the overview we recommend you use the same Kubernetes cluster as you are planning in production. You can find guides to install on different clouds [here](../install/helm-install/README.md). +As mentioned in the overview we recommend using the same Kubernetes cluster as planned in production. More guides to install on different clouds can be found [here](../install/helm-install/README.md). ### Persistence -We recommend your persistence in production to be HA, backup supported and point in time recovery supported. +We recommend your persistence in production to be HA, backup supported and point in time recovery supported. Below is a table of the persistence used and resources set for this test. | Persistence | # of nodes | RAM(GiB) | CPU | Total RAM (GiB) | Total CPU | |------------------|------------|----------|-----|-----------------|-----------| @@ -39,7 +39,7 @@ We recommend your persistence in production to be HA, backup supported and point #### Kubernetes Cluster Load Test Resources !!!note - Instance type can be selected to best suit the deployment intended. Keep in mind when selecting the instance type to strive for a `10` or up to `10` network bandwidth (Gbps). Above details the exact resources needed for this tutorial. + Instance type can be selected to best suit the deployment intended. Keep in mind when selecting the instance type to strive for a `10` or up to `10` network bandwidth (Gbps). Below details the exact resources needed for this tutorial. This is in addition to the persistence resources listed above. Resourcing is critical as timeouts in connections can occur, resulting in failed authentications or cutoffs. @@ -51,7 +51,7 @@ Resourcing is critical as timeouts in connections can occur, resulting in faile | Grand Total | | | | 288 GB | 144 | -You may choose to create a cluster with three nodes or more in one region and that's fine as long as the nodes are in multiple zones. We will continue with the above table and using microk8s. +A Kubernetes cluster can be created with three nodes or more in one region and that's fine as long as the nodes are in multiple zones. We will continue with the above table and using [microk8s](https://microk8s.io). 1. Create three ubuntu 22.04 nodes and run on each one the following: @@ -60,29 +60,33 @@ You may choose to create a cluster with three nodes or more in one region and th sudo snap install microk8s --classic sudo snap alias microk8s.kubectl kubectl ``` -2. Designate on of the nodes as the master. We will choose the us-west node to be our master. On the master node run: - - * Execute : - ```bash - microk8s.enable ingress dashboard observability dns metrics-server hostpath-storage registry - ``` - - * All the other microk8s nodes must be resolvable from within the master. If you are not using registered fqdns open the `/etc/hosts` file in the master node and map each hostname of the other nodes. You can get the hostname of the other nodes by executing the command `hostname`. - ```bash - # On master - echo "192.123.123.123 ubuntu-us-east" >> /etc/hosts - echo "192.124.124.124 ubuntu-eu-central" >> /etc/hosts - ``` - * Execute: - ```bash - microk8s add-node - ``` +2. Designate one of the nodes as the master. We will choose the `us-west` node to be our master. On the master node run: + + 1. Execute : + + ```bash + microk8s.enable ingress dashboard observability dns metrics-server hostpath-storage registry + ``` + + 2. All the other microk8s nodes must be resolvable from within the master. If fqdns are not globally resolved (registered) open the `/etc/hosts` file in the master node and map each hostname of the other nodes. YThe hostname of the other nodes can be obtained by executing the command `hostname`. + + ```bash + # If the hostnames are not globally resolvable on master + echo "192.123.123.123 ubuntu-us-east" >> /etc/hosts + echo "192.124.124.124 ubuntu-eu-central" >> /etc/hosts + ``` + 3. Execute: + + ```bash + microk8s add-node + ``` - Copy the output of the command above with `--worker` i.e `microk8s join 192.12.12.12:25000/88687d1cc5ecdee0db5014c4df9b82cb/adedf6a730eb --worker` and execute it in the other nodes to join them. You may need to reexecute step `2` for each worker node. + Copy the output of the command above with `--worker` i.e. `microk8s join 192.12.12.12:25000/88687d1cc5ecdee0db5014c4df9b82cb/adedf6a730eb --worker` and execute it in the other nodes (worker nodes) to join them. Step `iii` ( this step) needs to be repeated for each worker node. 3. Make sure [helm](https://helm.sh/docs/intro/install/) is installed. -4. Prepare your [override.yaml](../install/helm-install/README.md). Copy the below into a file named override.yaml. At the time of writing this we are using image tags `1.0.6_dev` which are the bleeding edge images for release `1.0.6`. You should use stable images such as `1.0.6-1`. +4. Prepare your [override.yaml](../install/helm-install/README.md). Copy the below into a file named override.yaml. At the time of writing this we are using image tags `1.0.6_dev` which are the bleeding edge images for release `1.0.6`. Stable images such as `1.0.6-1` should be used. + ```yaml config: image: @@ -100,57 +104,57 @@ You may choose to create a cluster with three nodes or more in one region and th cnSqlDbUser: root cnSqlDbTimezone: UTC cnSqldbUserPassword: Test1234# - global: - auth-server: - enabled: true - config-api: - enabled: true - cnPersistenceType: sql - cloud: - testEnviroment: false - fqdn: example.gluu.info - isFqdnRegistered: true - # In the event the fqdn above is not resolvable from the internet comment the above line and uncomment the below two setting your lbIp to your master ndoe ip. - #isFqdnRegistered: false - #lbIp: 192.12.12.12 - istio: - enabled: false - ingress: false - nginx-ingress: - enabled: true - fido2: - enabled: false - ingress: - fido2ConfigEnabled: false - scim: - enabled: false - ingress: - scimConfigEnabled: false - scimEnabled: false - auth-server: - image: - pullPolicy: IfNotPresent - repository: janssenproject/auth-server - tag: 1.0.6_dev - config-api: - image: - pullPolicy: IfNotPresent - repository: janssenproject/config-api - tag: 1.0.6_dev - persistence: - image: - pullPolicy: IfNotPresent - repository: janssenproject/persistence-loader - tag: 1.0.6_dev - nginx-ingress: - ingress: - path: / - hosts: - - example.gluu.info - tls: - - secretName: tls-certificate - hosts: - - example.gluu.info + global: + auth-server: + enabled: true + config-api: + enabled: true + cnPersistenceType: sql + cloud: + testEnviroment: false + fqdn: example.gluu.info + isFqdnRegistered: true + # In the event the fqdn above is not resolvable from the internet comment the above line and uncomment the below two setting your lbIp to your master ndoe ip. + #isFqdnRegistered: false + #lbIp: 192.12.12.12 + istio: + enabled: false + ingress: false + nginx-ingress: + enabled: true + fido2: + enabled: false + ingress: + fido2ConfigEnabled: false + scim: + enabled: false + ingress: + scimConfigEnabled: false + scimEnabled: false + auth-server: + image: + pullPolicy: IfNotPresent + repository: janssenproject/auth-server + tag: 1.0.6_dev + config-api: + image: + pullPolicy: IfNotPresent + repository: janssenproject/config-api + tag: 1.0.6_dev + persistence: + image: + pullPolicy: IfNotPresent + repository: janssenproject/persistence-loader + tag: 1.0.6_dev + nginx-ingress: + ingress: + path: / + hosts: + - example.gluu.info + tls: + - secretName: tls-certificate + hosts: + - example.gluu.info ``` 5. Run the following: @@ -167,6 +171,8 @@ Our tests used 10 million users that were loaded. We have created a docker image #### Loading users +Loading users requires a hefty but temporary amount of resources. By default, the resources ask for `10` vCPU and `5` Gis. However, to speed up the process increase the number of CPUs as the job in step two below uses parallel tasks. If left as is 10 million users would load in around 17 hours or so. + 1. Create a folder called `add_users`. ```bash @@ -174,7 +180,7 @@ Our tests used 10 million users that were loaded. We have created a docker image ``` 2. Copy the following [yaml](https://github.com/JanssenProject/jans/blob/main/demos/benchmarking/docker-jans-loadtesting-jmeter/yaml/load-users/load_users_rdbms_job.yaml) into the folder under the name `load_users.yaml`. -3. Open the file and modify the sql connection parameters +3. Open the file and modify the sql connection parameters. To speed the loading process increase the CPU requests and limits. 4. Create a namespace for load-testing. @@ -186,9 +192,10 @@ Our tests used 10 million users that were loaded. We have created a docker image ```bash kubectl create -f load_users.yaml -n load + cd .. ``` -Wait until all the users are up before moving forward. +Wait until all the users are up before moving forward. Tail the logs by running `kubectl logs deployment/load-users -n load`. #### Load testing @@ -196,6 +203,8 @@ Wait until all the users are up before moving forward. ###### Resources needed for Authorization code client jmeter test + The below resources were [calculated](#kubernetes-cluster-load-test-resources) when creating the nodes above. + | NAME | # of pods | RAM(GiB) | CPU | Total RAM(GiB) | Total CPU | |-------------------------------------|-----------|----------|-----|----------------|-----------| | Authorization code flow jmeter test | 20 | 8 | 1.3 | 190 | 24 | @@ -253,7 +262,7 @@ Create the client needed to run the test by executing the following. Make sure t 4. Download or build [config-cli-tui](../config-guide/tui.md) and run: ```bash - # Notice the namespace is jans here . Change it if you changed it previously + # Notice the namespace is jans here . Change it if it was changed during installation of janssen previously ROLE_BASED_CLIENT_ID=$(kubectl get cm cn -o json -n jans | grep '"role_based_client_id":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]') ROLE_BASED_CLIENT_SECRET=$(kubectl get secret cn -o json -n jans | grep '"role_based_client_pw":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d) # add -noverify if your fqdn is not registered @@ -266,12 +275,12 @@ Create the client needed to run the test by executing the following. Make sure t kubectl apply -f load_test_auth_code.yaml ``` -6. The janssen setup by default installs an HPA which will automatically scale your pods if the metrics server is installed according to traffic. If you would like to load it very quickly scale the auth-server manually: +6. The janssen setup by default installs an HPA which will automatically scale your pods if the metrics server is installed according to traffic. To load it very quickly scale the auth-server manually: ```bash kubectl scale deploy janssen-auth-server -n jans --replicas=40 ``` -7. Finally, scale the load test. You must control this replica number. +7. Finally, scale the load test. The replica number here should be manually controlled. ```bash kubectl scale deploy load-testing -n load --replicas=20 ```